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.

03 April 2012

Open CRM form via JavaScript

Have you been struggling to find out how to open a CRM form from another form or from a custom page?

Here is the solution:

Use window.open("/main.aspx?etn=entityname&pagetype=entityrecord&id=" + recordGUID");

or simply:
 window.open("/main.aspx?etn=entityname&pagetype=entityrecord");

to create a new record.

You can also pass custom parameters using the extraqs parameter and encodeURIComponent. You can find out more from the Crm SDK.

Cheers.