Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamics CRM 2011 - How to add a record to a Queue (QueueItem) using the REST Endpoint with Silverlight
    primarykey
    data
    text
    <p>I want to assign record to a particular queue in my Silverlight application.</p> <p>I display a list of record, and the user can select one or many record. Then I display a list of queue, and the user select the Queue in which he want to add those records.</p> <p>I've followed this example:</p> <p><a href="http://msdn.microsoft.com/en-us/library/gg309558.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/gg309558.aspx</a></p> <p>I've tried different way but it never worked.</p> <p>First, </p> <p>I've tried to create an "empty" QueueItem: (some parts of the code are missing, for example there is no Queue record here but it's not important, it's just to show you the issue)</p> <pre><code>internal void AddBillingToQueue() { QueueItem item = new QueueItem(); context.AddToQueueItemSet(item); context.BeginSaveChanges(OnCreateCompleted, item); } private void OnCreateCompleted(IAsyncResult result) { QueueItem item = result.AsyncState as QueueItem DataServiceResponse response = context.EndSaveChanges(result); // Normally, the GUID shouldn't be empty anymore, // but it fails at the EndSaveChanges line. } </code></pre> <p>The exception message said the objecttypecode was missing. So I tried again providing the object that I want to put in the queue.</p> <pre><code>internal void AddBillingToQueue(all_billing billing) { QueueItem item = new QueueItem(); item.ObjectId = new EntityReference() { Name = billing.all_name, Id = billing.all_billingId, LogicalName = "all_billing" } context.AddToQueueItemSet(item); context.BeginSaveChanges(OnCreateCompleted, item); } private void OnCreateCompleted(IAsyncResult result) { QueueItem item = result.AsyncState as QueueItem DataServiceResponse response = context.EndSaveChanges(result); // again it fails } </code></pre> <p>The exception message now says that the QueueId is missing. So I tried providing also the reference to the Queue.</p> <pre><code>internal void AddBillingToQueue(all_billing billing, Queue queue) { QueueItem item = new QueueItem(); item.ObjectId = new EntityReference() { Name = billing.all_name, Id = billing.all_billingId, LogicalName = "all_billing" } item.QueueId = new EntityReference() { Name = queue.Name, Id = queue.QueueId, LogicalName = "Queue" }; context.AddToQueueItemSet(item); context.BeginSaveChanges(OnCreateCompleted, item); } private void OnCreateCompleted(IAsyncResult result) { QueueItem item = result.AsyncState as QueueItem DataServiceResponse response = context.EndSaveChanges(result); // again it fails } </code></pre> <p>And here, the exception message is this one:</p> <pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?&gt; &lt;error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"&gt; &lt;code&gt;-2147217150&lt;/code&gt; &lt;message xml:lang=\"nl-BE\"&gt;Queue&lt;/message&gt; &lt;/error&gt; </code></pre> <p>According to this site ( <a href="http://www.cub-e.net/post/Microosft-Dynamics-CRM-Error-Code-List.aspx" rel="nofollow">http://www.cub-e.net/post/Microosft-Dynamics-CRM-Error-Code-List.aspx</a> ), the code means: <em>The specified entity was not found.</em> I suppose it means that Queue hasn't been found.</p> <p>But the GUID provided is definitely right because it has been retrieved from the same context.</p> <p>So, if I provide the Queue Id, it fails. And if I don't, it fails to. What have I missed? Does someone have already work with QueueItem and REST endpoint?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload