Tel. +44(0)208 4716864
info@softstuff-consulting.com
Follow us on Twitter  http://www.twitter.com/softstuffc
Softstuff Home Knowledgebase Home Contact Us Blog
GoldMine CRM SQL Server QuoteWerks Microsoft Excel Microsoft Word C# Windows XP Microsoft Dynamics CRM HEAT Sage CRM
Finding the current users WIP Queue

Wehn building integration pieces, using the Webservice interface its sometimes useful to be able to page through the logged in users Work in Progress Queue to either process the items in there, or assign them to another Queue.

The code below takes the CrmService obtained when you log in, and returns a
GUID value of the current users queue. If no Queue is found, or in the event more than 1 is returned it returns an empty Guid.

 
public static Guid GetWipQueueId(CrmService crm)
{
try
{
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse user;
{
user = (WhoAmIResponse)crm.Execute(request);
}
QueryByAttribute query = new QueryByAttribute();
query.EntityName = EntityName.queue.ToString();
query.Attributes = new string[] { "primaryuserid",
"queuetypecode" };
query.Values = new string[] { user.UserId.ToString(), "3" };

RetrieveMultipleRequest retrieve = new
RetrieveMultipleRequest();
retrieve.Query = query;
retrieve.ReturnDynamicEntities = true;
RetrieveMultipleResponse retrieved =
(RetrieveMultipleResponse)crm.Execute(retrieve);
BusinessEntityCollection Qs =
retrieved.BusinessEntityCollection;
if (Qs.BusinessEntities.Length == 1)
{
DynamicEntity de = (DynamicEntity)Qs.BusinessEntities[0];
KeyProperty property = (KeyProperty)de.Properties[0];
return property.Value.Value;
}
else
{
return Guid.Empty;
} // return a blank just in case
}
catch (SoapException e)
{
throw new Exception("GetWipQueueId\nUser:" +
"Serviceuser" + "\n" + e.Detail.InnerText.ToString());
}
}




01 December 2009  IB      Microsoft Dynamics CRM


Back To List

Did this article answer your question

 Yes

 No

 



 

Search our knowledgebase

Look In   For  
Enter a word or phrase to search for. eg. shrink

Enter your Email Address to receive the latest knowledgebase items delivered direct to your inbox.

Subscribe to the knowledgebase in your favourite RSS reader:   Plain RSS 2.0 Feed   Add to Google  Add to My Yahoo!

Note:
Softstuff accepts no responsibility for the use of information contained within this item. No warranties are implied or provided and it is advised that you have a working knowledge of the technologies contained, and we will not be held liable for system downtime, or data loss caused, unless we have specifically advised in writing to you that this is the case during the course of a support issue raised and accepted by us.
 

Copyright Softstuff Consulting 2007-2009