Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Update workerid via C# code

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

We are using CRM Dynamics 2015 update1 (Carina) online. I have C# code that uses an existing queueItem and calls RouteToRequest to move it to a different queue.

The workerId field (which starts out with a value in the existing queueItem) ends up being empty and there does not appear to be a way to set it with RouteToRequest.

So I added code in to update the workerId via calling the PickFromQueueRequest with an execute call.

This errors out with “You are not allowed to pick.” and a stack trace. It does not say anything about security being an issue in the stack trace.

 

I did locate a Microsoft example of how to update the workedId with the PickFromQueueRequest and it didn’t have anything unexpected in it compared to my code.

 

Any ideas on why this fails?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update workerid via C# code

    Thank you for the answer! The problem turns out to be that the destination queue was set to private and not defined as public as it should have been.

  • Suggested answer
    Royal King Profile Picture
    Royal King 27,686 on at
    RE: Update workerid via C# code

    Did you try with UpdateRequest to update the workedBy value?

    here is the code that worked forme to updated workerid in the queue item

    var updateReq = new Entity("queueitem");
    updateReq.Attributes["queueitemid"] = new Guid("{84B7D452-2845-E511-80F0-00155D016001}");
    updateReq.Attributes["workerid"] = new EntityReference("systemuser", new Guid("{784D6F09-A20E-E411-80BA-00155D01A00C}"));
    service.Update(updateReq);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans