Friday, December 9, 2011

When you enable duplicate detection and publish your duplicate detection rules, you will notice that when you try to create a duplicate in the CRM web application (or through Outlook client) you will get a pop-up indicating that you are trying to create a duplicate record. However, if the create/update request is sent via the web services to CRM (using the SDK) then by default, the duplicate record will be created without any warning.

The trick is that if you want to avoid creating duplicates when calling the CRM web services, you need to provide an optional parameter in the request which specifies that the server should check for duplicates before creating your record (by default the server will bypass duplicate detection). You must use a CreateRequest or UpdateRequest and provide the SuppressDuplicateDetection as “false”. Here is a sample for which my code will prevent creating duplicate accounts (note that I have already published a duplicate detection rule for accounts with the same name):

Monday, November 28, 2011

Many times when you are testing CRM you need to access the web application from multiple test users. It is a bit annoying to have to log out of Windows and log in with another user to test something in the CRM application. Here is a trick on how you can access CRM (OnPremise, IFD, Online) from different users at the same time (in different IE windows):

While pressing down the “Shift” key, right-click on the Internet Explorer icon and select “Run as a different user”:

For OnPremise CRM: Enter the credentials of the user which you want to test CRM with. When you go to the CRM site, you should be automatically logged in as the user that you selected to run Internet Explorer as. You can open as many IE sessions with as many different users as you want!

For IFD / CRM Online: For each CRM user that you want to test you need to enter the credentials for any existing user (domain or local user). Then you can navigate to the CRM login site and enter the CRM credentials for the user you want to test. You can also open as many sessions with different users as you want.

For CRM for Outlook: Unfortunately you cannot execute multiple simultaneous Outlook windows using different users (at least not that I know about).

I have found this trick quite helpful and now I find myself logged in to CRM with multiple users at the same time so I can test things like security roles, email, etc.

Monday, October 31, 2011

I posted earlier this year about how to share records using workflow in CRM 2011. Since then, I have got multiple requests to support “un-share” or revoking privileges to a record through CRM workflow. I have updated the CRM 2011 Workflow Utilities solution to support unsharing of records. It works very similar to the “share” step.

An unshare step is used in order to “unshare” or revoke shared privileges to the primary entity of the workflow (or a related entity) with a user or team. You must specify which record you want to unshare (primary vs. related). You can specify who you want to unshare the record with (user and/or team). Note that you can specify both a user and a team, in which case the record will be unshared with both. If you don’t specify any user/team then the record will be unshared with everyone with whom the record is currently shared. The configuration (input parameters) of the “unshare” step are similar to the share step. You can download the solution and read the documentation in the CodePlex site here.

Wednesday, October 12, 2011

It has often been asked why you cannot find a specific entity in the process designer. For example you might want to update and article from a workflow but you will notice that the process designer in CRM will not allow you to do that because the article entity will not be available.

So what does that mean?
There are special entities in CRM which are not supported in processes. For example, workflow does not support editing or creating articles because there is a special process for approving and publishing articles which the CRM workflow cannot handle.

How do I know if my entity is supported by workflow?
Each entity type in CRM has a read-only attribute called “WorkflowSupport”. This attribute will indicate the different levels of support that the entity has in a workflow. Additionally, there is the boolean “CanTriggerWorkflow” attribute which indicates whether the entity can be the primary entity of a process (whether a process can be defined on that entity).

Which are the different support levels for an entity in workflow and what do they mean?

Level

Description

1

On-demand workflows can be defined for this entity

2

This entity can be created in a process “Create” step.

4

This entity can be updated in a process “Update” step.

8

Workflow can send email from an email template for this entity.

An entity can have zero or more supported levels above. The “WorkflowSupport” attribute of the entity will contain the sum of all the levels which are supported for that specific entity. For example, the entity “annotation” (Note) has workflow support of 11 which means that it supports level 1, 2 and 8 (1+2+8 =11). Therefore the entity has all the workflow support except level 4, so you cannot edit a note in an “update” step of a process.

If the entity does not have the workflow support that I need, how can I update it?
Updating the WorkflowSupport or CanTriggerWorkflow attributes of an entity is unsupported and should never be done, there is a reason why the workflow support is the way that it is. You can read more about the risks of unsupported customizations here. You will need to consider using a plugin instead of a workflow/dialog to perform the action that you need. In some cases you could also use a custom workflow activity to implement your logic.

What is the WorkflowSupport for custom entities?
Custom entities have WorkflowSupport of 15 so they support all workflow support levels (1+2+4+8). They will also have the CanTriggerWorkflow attribute set to true.

What is the WorkflowSupport and CanTriggerWorkflow value for each entity?
The following list provides the values for each entity in CRM 2011:

About me

I used to be part of the CRM product team at Microsoft and I recently joined the Avanade Canada team as a consultant in the CRM Service Line, I developed a sort of delight in seeing how Dynamics CRM is evolving as a platform (xRM) and how its feature set has matured to be able to model and address plenty of business scenarios beyond Customer Relationship Management. I was recently given the Microsoft MVP award in Dynamics CRM and I am really excited to be part of the program and continue contributing to the CRM community.