Thursday, April 26, 2012

In Dynamics CRM 2011 we can manually assign the entity records to Queue from the Entity Form or List View (Grid) ribbon Add to Queue button but to assign the items automatically to queue, we can create a process Workflow, use JScript or can perform via C# or Vb.Net code.

The following example below can be use to add an entity record to the Queue via a process Workflow, Jscript and C# code.

[Workflow Process Example]

The following steps below describe the solution for adding a High Priority cases to the High Priority Cases Queue.

(If require to run this workflow for all Case records regardless of Business Units or User specific records)

·In Starts When check Record is Created option

3.AddCheck Condition step, click on the condition and In Specify Condition Web Dialog, choose Case (entity) in first list box, choose Priority (case entity field) from second list box, choose Equals (condition operator) in list box and choose High (case priority field value) in the final list box. The condition will look like:

CasePriorityEqualsHigh

4.Add Create Records Step in Crete field choose Queue Item, click on Set properties button and set the following properties:

·In Queue field, choose queue record i.e. High Priority Queue

·Click on Queue Item field and in Form Assistant Dynamics Values →In Look For choose Case in both list items, clickon the Add button and then OK

·In Worked By field choose User or Team to be assigned or leave this field empty for manual queue assignment

5.Click on Activate button to Activate the process

[C# Code Example]

privatevoid Main(IOrganizationService wod_CrmService)

{

// Assigning CRM Queue GUID value, the entity record will be added to this queue

Guid wod_QueueId = newGuid("51B0325E-1D8F-E111-A6A1-B8AC6F3EDD32");

// Assigning entity name & id, this entity record will be added to the queue

EntityReference wod_CaseLookup = newEntityReference()

{

LogicalName = "incident",

Id = newGuid("1B3B27C2-1C8F-E111-A6A1-B8AC6F3EDD32")

};

// Assigning the user Id to whom the queue item will be assigned

EntityReference wod_UserLookup = newEntityReference()

{

LogicalName = "systemuser",

Id = newGuid("1AF3D79C-C599-E011-868E-000C29C2F593")

};

// You may also assigned the record to the team by changing the

// logical name to team and changing Id value to Team record GUID value