Month: June 2013

Queue Item Work On vs. Case Assign


  1. When we say Assign on a particular CRM Case then it changes the Owner of the case.



    But when we say “Work on” on a “Queue Item” then it updates “Worked By” field in “Queue Item Details” rather than changing the owner of the case.



    Many a times mistake is made in considering these functionalities as same and can lead to design flaws in Application.


  2. When a case is assigned “Assign” message is triggered for a plugin but when we “Work On” from “Queue”, Update message is triggered on “Queue Item”.


  3. Out of the box CRM 2011 doesn’t provide any functionality to keep these both in sync so custom code (plugin) will be required to keep both these values in sync.


  4. If you want to move a case to user queue when it is assigned to user you can use out of the box feature of case entity (but it is not same as keeping work on and assigned to in sync as it is limited till a user queue only)


Record in Multiple Queue Error in CRM 2011

While looking at Queue Item Details we were getting Error


“This record is in multiple queues. Go to specific queue to view details.”


On doing the repro steps it was realized that this is the message that we get when a case is reactivated after being closed.

This is because a queue item related to same case is already there in CRM in deactivated state.


To resolve this we wrote a plugin to reactivate the queue item and assign it to a next level queue based on business logic.

Source Code to Reactivate Queue Item (Entity) in CRM 2011

[sourcecode language=”csharp”]

var entityMoniker = localContext.PluginExecutionContext.InputParameters[“EntityMoniker”] as EntityReference;

var incidentid = entityMoniker.Id;

QueryExpression query = new QueryExpression();

query.EntityName = “queueitem”;

query.ColumnSet = new ColumnSet();

query.ColumnSet.Columns.AddRange(new string[] { “statecode”, “statuscode”, “queueitemid” });

query.Criteria = new FilterExpression();

query.Criteria.AddCondition(“objectid”, ConditionOperator.Equal, incidentId);

query.Criteria.AddCondition(“statecode”, ConditionOperator.Equal, 1);

EntityCollection results = serviceContext.RetrieveMultiple(query);

if (results != null && results.Entities != null && results.Entities.Count > 0)


SetStateRequest setQueueItemState = new SetStateRequest();

setQueueItemState.EntityMoniker = new EntityReference(“queueitem”, results.Entities[0].Id);

setQueueItemState.State = new OptionSetValue(0);

setQueueItemState.Status = new OptionSetValue(1);




Repro Screenshots:

  1. Create case:


  1. Add it to queue


  2. Work On


  3. Resolve it

  4. Reactivate it:

  5. Add to queue Again

  6. Try to open queue item details.



    Error Message: