Answered by:
CRM 2011 How can i get the Default Queue of a user using SOAP calls

Question
-
I want to be able to retrieve the default queue of a user in dynamics crm 2011 using SOAP calls. I tried searching but did not generate any leads. Any help will be appreciated.
Thanks
Friday, September 20, 2013 2:00 PM
Answers
-
Hi,
The User's default queue will be stored in the QueueId field on the SystemUser entity. You can do a standard SOAP retrieve or retrievemultiple to get the value of that column and the queue.
Michael Palmer
xRMPalmer
@MJFPalmer
Rockstar365
- Marked as answer by GiveItAShot Monday, September 23, 2013 7:00 AM
Friday, September 20, 2013 2:10 PM -
Hi,
You can use the below OData JavaScript.
function GetQueueOfUser() {
var loggedInUserId = Xrm.Page.context.getUserId();
SDK.REST.retrieveMultipleRecords("SystemUser", "$select=QueueId&$filter=SystemUserId eq guid'" + loggedInUserId + "'",
function (results) {
var result = results[0];
if (result != null) {
var queueId = results[0].QueueId.Id;
var queueName = results[0].QueueId.Name;
var queueName = results[0].QueueId.LogicalName;
}}
}
function errorHandler(error) {
alert(error.message);
}Hope this helps!
Thanks!
- Proposed as answer by JLattimerMVP, Moderator Friday, September 20, 2013 6:01 PM
- Marked as answer by GiveItAShot Monday, September 23, 2013 7:00 AM
Friday, September 20, 2013 5:31 PM
All replies
-
Hi,
The User's default queue will be stored in the QueueId field on the SystemUser entity. You can do a standard SOAP retrieve or retrievemultiple to get the value of that column and the queue.
Michael Palmer
xRMPalmer
@MJFPalmer
Rockstar365
- Marked as answer by GiveItAShot Monday, September 23, 2013 7:00 AM
Friday, September 20, 2013 2:10 PM -
Hi,
You can use the below OData JavaScript.
function GetQueueOfUser() {
var loggedInUserId = Xrm.Page.context.getUserId();
SDK.REST.retrieveMultipleRecords("SystemUser", "$select=QueueId&$filter=SystemUserId eq guid'" + loggedInUserId + "'",
function (results) {
var result = results[0];
if (result != null) {
var queueId = results[0].QueueId.Id;
var queueName = results[0].QueueId.Name;
var queueName = results[0].QueueId.LogicalName;
}}
}
function errorHandler(error) {
alert(error.message);
}Hope this helps!
Thanks!
- Proposed as answer by JLattimerMVP, Moderator Friday, September 20, 2013 6:01 PM
- Marked as answer by GiveItAShot Monday, September 23, 2013 7:00 AM
Friday, September 20, 2013 5:31 PM