I saw one question in the
CRM community forum today where a user was looking for help to use PickFromQueue message, so I thought of writing sample code for the same, so that it can help others as well. Let’s first understand the message and why we need it. As the name suggests this message is used to pick items from queue and used to assign to some user, so it’s basically the queue item routing, which we can do using Route button after selecting queue item like the following.
We can get full properties details from here.
And here is the code to use this request:
- try
- {
- IOrganizationService organizationService= GetCRMService();
-
- PickFromQueueRequest request = new PickFromQueueRequest();
- request.QueueItemId =new Guid("GUID of the queueitem");
- request.RemoveQueueItem = true;
-
- request.WorkerId = new Guid("GUID of the user whom we want to assign");
-
- organizationService.Execute(request);
- }
- catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> ex)
- {
-
- Console.WriteLine(ex.Detail.Message);
- }
Stay tuned for more sample code.