Blog Archives

Presenting at CRMUG Summit EMEA. Amsterdam 2017

This year I’ll be presenting at the CRMUG Summit EMEA 2017 celebrated in Amsterdam. The idea started last year when I was speaking with my Microsoft AX MVP colleague Antonio @_Gilabert_ at the MVP Summit.

CRMUG_EMEA_Summit_Amsterdam2017_Home

With Dynamics 365, CRM and AX are closer than ever, so we thought that it would be great to have a presentation together and share our experience and view with the community.

We would like to do a functional and practical session where we will show how both platforms can be integrated, in the new Dynamics 365 world, to deliver a real business scenario. Our challenge is to use the new Microsoft Flow and Common Data Service for the integration. At the moment, they are still very new and many capabilities are very limited.

Although we are still working in the demo, we are also preparing a PowerApp to improve the user experience and present how they can be useful alongside Dynamics 365 for Sales and Operations.

I would also like to say thank you to Hugo de Jesús, who is helping us a lot to prepare the presentation.

You can find more information about the schedule in this link.

We hope you enjoy the event, and of course, our session! 🙂

CRMUG_EMEA_Summit_Amsterdam2017_CRM and AX rock together

 

 

Dynamics 365 (CRM) Scheduled Workflows using Microsoft Flow

Creating scheduled workflows has always been a challenge in Dynamics CRM 365. The community and ISVs have offered several original options, but there is not yet an official out-of-the-box option. This article brings another alternative to the table using Microsoft Flows.

A scheduled workflow is the one that runs at a certain arranged time and it may recur to run again after a period of time. If you want to understand more about this challenge and how our CRM community has resolved it so far, have a look at the following articles:

Microsoft Flow offers the option to create Recurrence jobs. This can be used to schedule and trigger actions in Dynamics 365, like retrieve, create or update records (see available actions). So, using this functionality you already have a good alternative to create your own scheduled workflows without development effort. You can see some examples in the following article as well as in these Dynamics 365 Flow templates.

The other alternative would be a mix solution where a recurrence Microsoft flow creates a custom Dynamics 365 “Scheduled Job” record and this triggers the corresponding Dynamics 365 workflow. The “Scheduled Job” entity would have attributes like “Process Name”, “Run as” (e.g. system user name), “Query scope” (e.g. FetchXML or view name), …, to specify what and how to run the workflow. This option would require additional development, either a plugin or a custom workflow activity to call on demand the given process, but it would also allow you to reuse the logic and capabilities you already have within Dynamics 365.

Hope you find this article useful. Looking forward to hearing your feedback.

Thanks

Too many active business process flows

Have you seen that message before on your Microsoft Dynamics CRM organisation?

Too Many Active Business Process Flows Error

You may have if you have tried to activate more than 10 business processes at the same time for the same entity.

List Of BPF On The Case Entity

This is a limitation by design which is well-known and described on the Microsoft technical documentation, have a look at the following article.

This limitation can be changed using the organisation property Organization.MaximumActiveBusinessProcessFlowsAllowedPerEntity. The easiest way to to change this attribute is using the following tool: Dynamics CRM Organization Settings Editor (OrgDBOrgSettings)

CRM Org Settings Editor

And now, you may be thinking: “why on earth would you do that??”

If your CRM deployment is heavily used, some core entities (e.g. Case, Opportunity) may be used intensively on different processes across an organisation.

Note: the current CRM version I’m using is: (8.1.0.369) (DB 8.1.0.369)

[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

 

 

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:

[CRM 2011] Intermittent RetrieveMultiple error: Index was out of range. Must be non-negative and less than the size of the collection

Few weeks ago, I faced an interesting intermittent issue using the CRM Service, specifically with the RetrieveMultiple message. Basically, there was a WCF service wrapping the CRM Service and eventually we were getting the same issue you can find in this MSDN CRM forum post

 After some deep investigation, it turned up to be a thread safe issue related to the way IServiceConfiguration and IServiceManagement are shared internally in the CRM libraries. IServiceConfiguration is not safe thread. Another important point to be considered was the early-bound types, which are not guarantee to be thread safe. (See http://technet.microsoft.com/en-us/library/gg326004.aspx).


Finally, a simple solution for this issue was to change the connection configuration:

CrmConnection crmConnection = new CrmConnection("myCRMConnection");
crmConnection.ServiceConfigurationInstanceMode = ServiceConfigurationInstanceMode.PerInstance;
using (CRMContext serviceContext = new CRMContext(crmConnection))
{

}

ServiceConfigurationInstanceMode.PerInstance is the key

Related to this topic, I recommend reading the new section Best Practices for Developing with Microsoft Dynamics CRM 2011, which is part of SDK 5.0.12 and newer ones.

Microsoft.Crm.Reporting.RdlHelper.dll not found

Updating from Visual Studio an existing SSRS CRM report (e.g. Activities) may require an external reference to the assembly Microsoft.Crm.Reporting.RdlHelper.dll. This assembly contains several helper functions which can be used from your report.

This assembly can be found in the SSRS report server, normally in the next folder:

C:\Program Files\Microsoft SQL Server\MSRS10.CRMRS\Reporting Services\ReportServer\bin

An easy way to make this reference works is your Visual Studio is to deploy the same assembly into the GAC of your desktop

In my case, I updated the Activities (parent) and Activities Detail (child) reports to include Accounts as part of the regarding. Out of the box, this report only provides the activities linked to Incidents and Opportunities.

Basically, I followed the next steps:

1) Download SSRS report from CRM. Edit Activities report => Actions => Download report and rename it. Repeat the same for Activities Detail report

2) Open Activities report from Visual Studio

3) Deploy RdlHelper.dll in the GAC of my desktop

4) Edit DSActivity dataset query to include accounts (both reports, parent and child)

5) Include new parameter CRM_FilteredAccount (both reports, parent and child)

6) In your new renamed Activities report, update series action to go to new child report. From Design View, right click on the series => Series Properties =>Action => Go to report and selecte the new child report, the one renamed from Activities Detail. Just in the same form, add a the new parameter CRM_FilteredAccount – [@CRM_FilteredAccount]

7) Upload your new reports to CRM.

8) Set up the parent report for the new child report Activities Detail.

I hope it helps.

[CRM 2011] Change Home Page

Basically we have two options to change our hombe page in CRM 2011:

  • Per User: Using UI, any user can change his/her own home page. See the next post
  • All User: This is not as user friendly because we have to call the webservices (Online or On-Premise) or run a SQL script (On-Premise)

Web Services: Execute the request UpdateUserSettingsSystemUserRequest, you can find a good example from  Gonzalo Ruiz (MVP) in this post

SQL Scritp: Run the next script:

update [DB_NAME].[UserSettingsBase]

set HomepageArea =‘A’, HomepageSubarea =‘A_1’

MSCRMTracing Event Log error

Getting a MSCRMTracing error in your Event Log? Probably you have read the next entries. Once you understand them, apply the PowerShell script showed below.

http://support.microsoft.com/kb/907490

http://social.microsoft.com/Forums/el-GR/crmdeployment/thread/1f8ac761-196c-4814-9d82-d48d297a9648

PowerShell Script:

Add-PSSnapin Microsoft.Crm.PowerShell

$setting = Get-CrmSetting TraceSettings

$setting.Directory = ‘Drive:\Program Files\Microsoft Dynamics CRM\Trace’

Set-CrmSetting $setting