Featured Post

Web API Requests Series

Web API Series:  Create and Retrieve , Update and Delete , Retrieve Multiple , Associate/Disassociate , Impersonation , Run Workflows

13 April 2012

How to assign a record to another User in CRM 2011

In this brief post I will show you how to set the Owner of a record in C#, in other words how to assign a record to a User.

To assign a record an Owner you have to send an Assign Request using the Execute method.


service.Execute(new AssignRequest()
                                                    {
                                                        Assignee = new EntityReference("systemuser", userId),
                                                        Target = new EntityReference(updateEntity, recordId)
                                                    }
                );

The Assign  Request has two properties:

  1. Assignee: This can be either a Team or a User.
  2. Target: this is the record you want to assign.

Hope this helps.

No comments:

Post a Comment