Retrieve Method

The Retrieve method gets an instance of an entity object. To get more than one instance of an entity, use the RetrieveMultiple method (explained in the next section).

This method returns a class type of Entity. The input parameters are the string of the entity name, the GUID of the instance of the entity, and a set of columns or fields you want to retrieve.

Tip

It is important to define the columns you want to retrieve in the last parameter; otherwise, you will get null values even though the instance in the CRM system has values.

Listing 24.3 provides an example of the Retrieve method.

LISTING 24.3 Retrieve Method

private static XrmSdk.Entity RetrieveAccount(string organizationName, Guid accountId) ...

Get Microsoft Dynamics CRM 2013 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.