[Dynamics CRM] Find processes by content

Using any version of Dynamics CRM, have you ever tried to find all processes that contain

  •  A certain Step in some Business Process Flow
  • A Custom Workflow Activity that you have developed and you try to reuse in several Workflows
  • A Dialog that contains some particular question
  • An Action with an specific parameter

If so, probably you noticed that Advanced Find (an out-of-the-box CRM tool to create custom queries) is not enough.

Let’s just understand the anatomy of the processes. CRM uses internally Windows Workflow Foundation as its workflow engine, so that CRM processes are defined using XAML. So, when you create a process using the CRM UI designer, the platform translates it to XAML.

So, then, we are looking for those processes which XAML contains some text. Looking at the metadata of the Process entity, we can see there is an attribute called XAML:

DXTools Metadata Browser - Process XAMLNote: You can find this Metadata Browser in CodePlex, see http://dynamicsxrmtools.codeplex.com/. You can also use the CRM SDK Metadata Browser

Now the question: how do we interrogate this XAML attribute? Solution: CRM OData query

CRM exposes an OData service which can be easily consumed by external applications or even using the browser. See more information in CRM SDK. Because this service allows to access more attributes than the Advanced Find tool, we can use the next query to find the processes whose XAML contains a certain string:

https://[OrganisationName].crm[x].dynamics.com/xrmservices/2011/OrganizationData.svc/WorkflowSet?$filter=substringof(‘[String]‘,Xaml) and Type/Value eq 1

The parts marked with brackets should be replaced with your corresponding context. The last condition is just filtering the Type of process, returning only those which are the actual Definition (Value: 1).

You can also build easily this query using the tool OData Query Designer in CodePlex, see http://dynamicsxrmtools.codeplex.com/.

Let’s try it now! Out of the box there is a Business Process Flow called “Lead to Opportunity Sales Process”, which contain an step with name “Existing Contact?”:

RTBlog - XAML Process - LeadToOpportunityFlow

RTBlog - XAML Process - LeadToOpportunityFlowDefinition

Let’s say we want to find any process that contains that step “Existing Contact”, so we will use the next query:

https://%5BOrganisationName%5D.crm%5Bx%5D.dynamics.com/xrmservices/2011/OrganizationData.svc/WorkflowSet?$filter=substringof(‘Existing Contact‘,Xaml) and Type/Value eq 1

Just putting that query in IE, we will see the next results:RTBlog - XAML Process - ODataQueryResultsSample1

Another example. Let’s say you are using N52 Formula Manager and you want to find all processes that are using a particular Formula Genie. In our example, this formula is going to generate a Hashcode for a given contact based on its fullname. This hashcode can be used for de-duplication:

RTBlog - XAML Process - N52FormulaGenie

Now, I want to find all the processes that are using this formula at least in one of their steps. So I will use the next OData query:

https://%5BOrganisationName%5D.crm%5Bx%5D.dynamics.com/xrmservices/2011/OrganizationData.svc/WorkflowSet?$filter=substringof(‘uzX,Xaml) and Type/Value eq 1

Where “uzX” is the formula short code.

Putting that query on IE, I will get the next results:

RTBlog - XAML Process - ODataQueryResultsSample2

New Customer” is a custom process that I created to use that formula and generate a hashcode every time a new contact is created or its full name gets updated:

RTBlog - XAML Process - NewCustomerWorkflow

See below a contact sample with a hashcode (below full name attribute), which has been generated by the above process:

RTBlog - XAML Process - ContactHashcodeSample

 

 

Comunidad CRM 2014 Expert Contributor

Comunidad CRM 2014 Expert Contributor_1During 2014 I have enjoyed helping the Spanish-speaking users group Comunidad CRM. It is a great community focused on Microsoft Dynamics CRM. They organise technical webcasts, training, forums, blogs and other activities like Twitter (@ComunidadCRM).

Comunidad CRM 2014 Expert Contributor_2These guys are always active and keen to help you with any CRM question you may have. It doesn’t matter if you are a dummy or you are an expert, you can always contribute, help and learn from it. If you are interested in Dynamics CRM and you speak Spanish (or you want to learn it :) ), join @ComunidadCRM!

Just in December, I received a warming and rewarding email for my contribution and help to this community. This year 2015 I will definitely carry on helping them and sharing the new exciting changes coming with the latest version CRM 2015. Hope to see you around ;)

Microsoft publishes CRM SDK in NuGet (Visual Studio)

CRM SDK is now also available from the Visual Studio extension NuGet. This extension is a provider of third party packages where anyone can participate and publish their own ones. This makes very easy to add third party assembly references.

  • Install NuGet in Visual Studio from “Tools => Extensions and Updates”

  • Once NuGet is installed, create a Visual Studio Project (a library for example) and make right click on the Visual Studio project where the CRM SDK assemblies will be used. Select “Manage NuGet Packages…”

  • Choose the Online option on the left menu and search for “crmsdk“. A list with all the CRM SDK assemblies published by Microsoft will be presented. Choose the corresponding assembly based on its version.

In this case, I have installed the CRM 2013 assemblies:

  • Notice the new package and reference configuration linked to the project:
    • packages.config” file in the project where the NuGet packages have been installed

    • New folder with the assemblies in the root solution folder. You can find the assembly file within the package folder. In this case, the new CRM 2013 SDK package contains two assemblies, see below:

    • New library reference have been added automatically to the chosen project:

[Online Team Foundation Service] Icons are missed in the buttons

FIXED!

Last week I noticed many of the icons in the buttons of our Online Team Foundation Service have been disappeared. This issue only happens with IE 10. I have tried the compatibility mode but no difference.

Workarounds:

  • It works fine with Chrome (28.0.1500.95).
  • Turn on Internet Options -> Advanced tab -> Use Software Rendering in IE

See more information about this bug here:

http://connect.microsoft.com/VisualStudio/feedback/details/800974/online-team-foundation-service-icons-are-missed-in-the-buttons

Local DateTime CRM Online SSRS Report

Local DateTime in UK could get a bit tricky because of the summer time, where it is one hour less in UTC time.  This post will help you to find out the local Date.

There is a simple solution for this: Use the date only field from the dataset. When the CRM date attribute (e.g. “MyDate”) is declared in the Fetch XML query of your dataset, you get two SSRS fields in that dataset: MyDate and MyDateValue. The first one is a date only field in local time, so you can do something like Fields!MyDate.Value. The second one is a datetime field in UTC time. You are probably interested in the first one ;)

If you also want to force a UK time format, you can use the next expression:

=iif(IsNothing(Fields!MyDate.Value),

Nothing,

CDate(iif(IsNothing(Fields!MyDate.Value), 1, Mid(Fields!MyDate.Value, 4, 2)) &

“/” & iif(IsNothing(Fields!MyDate.Value), 1, Mid(Fields!MyDate.Value, 1, 2)) & “/” & iif(IsNothing(Fields!MyDate.Value), 1, Mid(Fields!MyDate.Value, 7, 4))))

Just to say thanks to my colleague Mario (@mtcantero // http://crmandcoffee.wordpress.com/) for his input in this article.

9th to 13th September, join the MVP community in London for a ‘real world’ look at the Microsoft Cloud OS

Image

Monday 9th September at the Microsoft Office, Victoria, London

Join leading MVPs for a two track one day event that tackles the delivery of Enterprise data platforms and analytics solutions.

Please register to attend either track 1 or track 2:

·         Track 1 will focus on building of an enterprise data platform exploiting both cloud and on-premises technologies. We will also talk about how to handle structured and unstructured data, along with integrating a range of Microsoft and non-Microsoft technologies to tackle architecture, process and governance issues.

Register to attend

·         Track 2 will focus on the creation of Business Intelligence and advanced analytics solutions that utilise both structured and un-structured data. We will demonstrate the use of data mining and predictive analytics technologies and also demonstrate how advanced visualisation technologies can be used by business users to deliver the insight and action required to drive real value from data.

Register to attend

Tuesday 10th September at the Microsoft Office, Victoria, London

Join leading MVPs for a one day event to assist management and virtualization experts to understand the advances in the modern datacentre.

 Each session will demonstrate how to:

·         Deliver best practices with Windows Server 2012 R2 and System Center 2012 R2

·         Lower costs through effective management of VMware and Hyper-V

·         Enable management of datacentres of any size!

·         Drive automation of complex applications with service templates

Register to attend

Wednesday 11th September at the Microsoft Office, Victoria, London

Join leading MVPs for a one day event focusing on technology that make up the Microsoft Integration Platform.  Allowing organisations to leverage a combination of cloud and on-premise applications through the hybrid integration pattern.

 Sessions will include:

·         Windows Azure Service Bus

·         Windows Azure BizTalk Services

·         Microsoft BizTalk Server 9both on-premise and cloud Virtual Machine

 Register to attend

Thursday 12th September at the Microsoft Office, London, Victoria

Join leading MVPs for a one day event to understand how to manage your client devices in a single tool while reducing costs and simplifying management. Best of all, you can leverage your existing tools and infrastructure.

Sessions will include:

·         Helping with data security and compliance

·         Unified device management

·         What powers people-centric IT with Cloud OS?

·         Real World customer examples

Register to attend

Friday 13th September at Microsoft Office, Victoria, London

The explosion in devices, connectivity, data and the Cloud is changing the way we develop and deliver software.  New infrastructure services permit existing server applications to be “lifted & shifted” into the Cloud.  Attend a one day event to hear from MVPs about how Microsoft’s data platform and development tools enable you to develop, test, and deploy applications faster than ever.

Sessions will include:

·         Infrastructure services,

·         Media services,

·         Service Bus  &

·         Mobile services

 Register to attend

Microsoft Developer Network

Microsoft Developer Network has just launched. Microsoft wants to enhance the experience to add better support for the growing number of developers that are embracing Microsoft’s platform and technologies for the first time.

There were a few goals Microsoft targeted with the Microsoft Developer Network experience:

  • Simple:   The new Microsoft Developer Network site is designed to help developers easily find information and get started with Microsoft more effortlessly.  They heard from the community that finding the right information, often spread between different locations, could be challenging.  The Microsoft Developer Network addresses that feedback by providing a single point of entry for all developers.
  • Relevant: They want to meet developers where they are and talk with them on their terms.  With the Microsoft Developer Network, an iOS developer, for example, can quickly understand the opportunity available from our platform and then easily navigate to the educational or technical content he needs to get started.
  • Community Driven: Microsoft has an incredible developer ecosystem, and they wanted to provide even more opportunity for the community to engage with them and with each other.  They designed the Microsoft Developer Network with that in mind, creating a “Perspectives” section with community blogs, an integrated social feed, and a “Connect” area that allows developers to tell their stories, get advice and connect with them directly.

The site launch happened last week for English-based geographies, but this is just the beginning of a phased worldwide launch.   Expect to see the global launch roll out over the next few months!

Check it out and let them know what you think.  http://developer.microsoft.com

I have read “Microsoft Dynamics CRM 2011 Reporting”

Reporting is already a fundamental pillar for many companies and senior management. It brings the ability to understand key factors of the business such as the volume of opportunities, revenue and performance. The book Microsoft Dynamics CRM 2011 Reporting is a useful technical guide which delivers a simple and clear overview of the available reporting options within the platform Microsoft Dynamics CRM.

Microsoft Dynamics CRM is a flexible business solution based on SQL server that provides different and several reporting capabilities. Business users can create their own reports without real technical knowledge. At the same time, more complex designs can be implemented by developers or technical administrators using known Microsoft tools like Visual Studio or Report Builder. The author of the book, an experienced Microsoft MVP, have captured all this reporting functionality within the same.

The book follows an intuitive structure, explaining how to create simple reports using the Report Wizard of Dynamics CRM and covering basics technical aspects like SQL and Fetch XML. Gradually, it introduces more complex implementations using SQL Server Reporting Services, integration with web resources and generation of reports using other technologies such as ASP.NET or Silverlight. Finally, the book offers a couple of interesting chapters related to Failure Recovery, Best Practises and Mobile reporting, which are very important aspects for enterprise implementations.

Other basic reporting features like Charts and Dashboard are also mentioned in the book. However, a topic which is not included in the book is the Export to Excel feature. With Dynamics CRM, users have the ability to create custom views and queries that can be exported to Excel. This is a very useful functionality, especially considering that many users are already familiar with Excel and its report capabilities.

Personally I have enjoyed reading Microsoft Dynamics CRM 2011 Reporting. It is a helpful reference I would recommend for new Dynamics CRM users and developers. It contains many images and screenshots that make very easy to understand and follow Damian Sinay’s explanations.

[CRM Online] Avoid attachments using a plugin and weird exception messages: The specified domain does not exist or cannot be contacted. An unexpected error occurred from ISV code

Writing a simple plugin to avoid attachments in Dynamics CRM Online, I have seen weird exceptions messages.

Note: Using Dynamics CRM 2011 Developer Toolkit from CRM 2011 SDK

Find all the code of this example and the CRM solution here

Initially, this is the code of the plugin linked to “annotation” in the Create and Update events (shown just the execute method):

image

Now, let’s try to attach a new file:

image

In this case, where an unknown error will happen, I could expect a message similar to this:

image

Notice I would be able to retrieve traces and see more information.

However, instead of that message, I am getting this other weird error without any trace or useful information: “The specified domain does not exist or cannot be contacted. An unexpected error occurred from ISV code”

image

To improve this message, I have had to add a try-catch, encapsulate that unexpected exception and throw an InvalidPluginExecutionException:

image

And now I get the next message:

image

As you can see, this message is a bit more friendly, but it is not yet the usual desired message we would like seeing with traces, something like this:

image

 

Conclusion:

Exception messages in attachments for the annotation entity seem to behave differently compare to what we have seen in other entities. Use InvalidPluginExecutionException correctly to guarantee the best result.

Other advices/ideas:

If you are using CRM 2011 Developer Toolkit, Plugins inherit from Plugin class. You can improve the error handling in this base class and customise the traces and error logs in the way you better want.

[CRM 2011] Insufficient permissions

Trying to create a Case (incident) and I was getting the familiar message “Insufficient permissions… contact your administrator”:

Insufficient Permissions

My security role seemed to be fine, I got enough permissions to create, update, read,… the case entity. But, the initial error message didn’t help me at all to understand what I was missing.

Then, I just released the details of the error and the reason of the same were in the URL :) :

https://org-name/_common/error/errorhandler.aspx?BackUri=https%3a%2f%2fredbank4.crm4.dynamics.com%2fmain.aspx&ErrorCode=0x80040220&Parm0=%0d%0a%0d%0aError%20Details%3a%20Principal%20user%20%28Id%3dcc0a77bb-d792-e211-b15e-b499bafdbeda%2c%20type%3d8%29%20is%20missing%20prvReadSubject%20privilege%20%28Id%3dd5d40a46-b459-438b-941e-d55691bf0827%29&RequestUri=%2fmain.aspx%3fetc%3d112%26extraqs%3d%253f_gridType%253d112%2526etc%253d112%2526id%253d%25257b2ABE0394-E875-E211-B10A-B499BAFDBEDA%25257d%2526pagemode%253diframe%2526preloadcache%253d1365599628453%2526rskey%253d846695103%26pagetype%3dentityrecord&user_lcid=1033

Exactly, in this case I was missing the read permission in the Subject entity

Hope it helps!

Follow

Get every new post delivered to your Inbox.