How to get the QueueItem details for an Object – CRM 2011/CRM 2013

If you have noticed, in CRM 2011/2013, it is common that when you click on an QueueItem record in any of the Queue Item views, it always opens the Actual Object i.e. the case record or activity record or Lead record etc. the same thing happens when you define a ribbon button and pass the selectedID as a crmParamater to the Ribbon action (opening a web url or calling a java script function), on click of the ribbon buttion the guid that you get as the selected record id is actually not the Guid of the Corresponding QueueItem that holds the object but the Guid of the actual object i.e the case/activity/lead etc.

so what is the solution, to get the QueueItem ID, in case you have any operations to perform on its properties, the only option is to make the Odata query to get the QueueItem id for the corresponding ObjectID, as in CRM only one QueueItem exists for an Item, hence, the below query is safe, as in any case you can never get more than one record in the result set.

here is the query. Please note the uses the OData Retrieve Multiple Query Method named GetODataResults, to get the java script for it refer to my previous blog

function getQueueItemID(selectedRecordID) {

var queueitemID = null;

var selectedObjectID = args[0][1].replace(“%7b”, “”).replace(“%7d”, “”);

var queueTeamQuery = “QueueItemSet?$select=QueueId,QueueItemId,queue_entries/OwnerId,queue_entries/OwningTeam,queue_entries/OwningUser&$expand=queue_entries&$filter=ObjectId/Id eq guid'” + selectedObjectID + “‘”;

var queueTeamdetails = GetODataResults(queueTeamQuery);

if (queueTeamdetails != null) {

queueitemID = queueTeamdetails.QueueItemId;




This entry was posted in CRM 2011, CRM 2011 Online, CRM2013, java script, OData and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s