RetrieveMscrmRecords()

Retrieves data from Microsoft Dynamics CRM entities.

Availability 

Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No

Syntax 

1RetrieveMscrmRecords(entityName, fieldsToRetrieve,
2                     queryFieldName, queryFieldOperator, queryFieldValue)

The RetrieveMscrmRecords() function has five parameters:

  • entityName (string): Required. The name of the Microsoft Dynamics CRM entity to retrieve records from.
  • fieldsToRetrieve (string): Required. A comma-separated list of fields to retrieve.
  • queryFieldName (string): Required. The name of the field to filter on.
  • queryFieldOperator (string): Required. The operator to use for the filter.
  • queryFieldValue (string): Required. The value to filter on.

Usage 

This example retrieves the contact ID, first name, and last name for all contacts where the last name is Santos.

1%%[
2  Var @records_retrieved, @counter, @firstname, @lastname, @id
3  Set @records_retrieved = RetrieveMscrmRecords("contact", "contactid,firstname,lastname",
4                                                "lastname", "=", "Santos")
5]%%
6
7<p>Contacts:</p>
8<br />
9
10%%[
11  For @counter = 1 to RowCount(@records_retrieved) do
12  Set @firstname = Field(Row(@records_retrieved,@counter),'firstname')
13  Set @lastname = Field(Row(@records_retrieved,@counter),'lastname')
14  Set @id = Field(Row(@records_retrieved,@counter),'contactid')
15]%%
16
17<p>First: %%=v(@firstname)=%%</p>
18<p>Last: %%=v(@lastname)=%%</p>
19<p>Id: %%=v(@id)=%%</p>
20<br />
21
22%%[ Next @counter ]%%