RetrieveMscrmRecordsFetchXml()

Returns the attributes specified in a Fetch XML query.

Availability 

Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No

Syntax 

1RetrieveMscrmRecordsFetchXML(fetchXmlQuery)

The RetrieveMscrmRecordsFetchXML() has one parameter:

  • fetchXmlQuery (string): Required. A Microsoft Dynamics CRM Fetch XML query.

Usage 

This function uses a Fetch XML query to retrieve the contact IDs, email addresses, first names, and last names of contacts who have a specific subscriber key.

1Var @FetchXml
2Set @FetchXml = concat('<fetch mapping='logical' count='1' version='1.0'> <entity name='contact'> <attribute name='contactid' /> <attribute name='emailaddresstring' /> <attribute name='firstname' /> <attribute name='lastname' /> <filter> <condition attribute='contactid' operator='eq' value='', @SubscriberKey, '' /> </filter> </entity></fetch>')
3Set @RowSet_All = RetrieveMscrmRecordsFetchXML(@FetchXML)
4
5If Rowcount(@RowSet_All) >= 1 then
6    Set @RowSet = Row(@RowSet_All, 1)
7    Set @contactid = Field(@Rowset,'contactid', 0)
8    Set @emailaddresstring = Field(@Rowset,'emailaddresstring', 0)
9    Set @firstname = Field(@Rowset,'firstname', 0)
10    Set @lastname = Field(@Rowset,'lastname', 0)
11EndIf

See Also