Tag Archives: Code

Perform Action for 1:N and N:N Relationship in CRM 4.0 workflow editor

currently CRM 4.0 workflow editor allow you to update relevant record with N:1 relationship only, for example if you are in case screen then you can update related Account/Contact record only but if you want to update all tasks related to Case then you cannot able do it currently in Out of the box system.

Just came across this new project on codeplex which provides custom workflow which you can just register and this will extend (or add new action sub menu) in workflow editor screen to allow performing action for 1:N and N:N Relationship.

Following is the details from the CodePlex Site

Project Description
This plug-n allows to execute a workflow for each entity that has a 1:N or N:N relationship to a given entity.
For example: execute a workflow for each case related to an account (1:N), or for each competitor related to an opportunity (N:N), etc.

Summary
With CRM 4.0 out-of-the-box it is possible to perform actions on entities that have a N:1 relationship to a given entity, For example from an opportunity it is possible to update or run a workflow on the parent customer.

This plug-in allows to extend this to the other two possible relationships: 1:N and N:N. With the aid of this plugin it is possible to perform an action on each opportunity given the parent customer (1:N) or on each competitor given the opportunity (N:N) or on each opportunity given the competitor (other way of the same N:N).

Installation
Copy the .dll to the Microsoft Dynamics CRM\Server\bin\assembly folder
Run the Plug-in Registration tool and register the .dll
If the plug-in was registered successfully, a new action sub-menu (Utilities) will be available when selecting a workflow action.

Download Project documentation and files : http://crm40distributewf.codeplex.com/

Removing email from CRM queue

Currently if there is email in queue and if user manually creates case then case gets creates but email remains in the CRM queue.

Another scenario is that there is automated workflow which creates case for the email which comes in queue and workflow creates case fine but email remains in the queue.

For above two problems there is not out of the box method to remove or detach the email from the queue. However when I check CRM 4.0 SDK there is API DetachFromQueueEmailRequest Based on which I have created following generic custom workflow which takes queue id and email id as Input and removes the relevant email from the relevant queue.

Following is full code snippet for this..

Register this custom workflow using Plug in Registration Tool and you can use this utility in CRM workflow screen now…

Code can be downloaded from following link
View & Download Code File