RetrieveMscrmRecordsFetchXml()

Returns the attributes specified in a Fetch XML query.

Availability

<table> <tr> <td>Marketing Cloud Engagement</td> <td>✅ Yes</td> </tr> <tr> <td>Marketing Cloud Next</td> <td>❌ No</td> </tr> </table>

Syntax

RetrieveMscrmRecordsFetchXML(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.

Var @FetchXml
Set @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>')
Set @RowSet_All = RetrieveMscrmRecordsFetchXML(@FetchXML)

If Rowcount(@RowSet_All) >= 1 then
    Set @RowSet = Row(@RowSet_All, 1)
    Set @contactid = Field(@Rowset,'contactid', 0)
    Set @emailaddresstring = Field(@Rowset,'emailaddresstring', 0)
    Set @firstname = Field(@Rowset,'firstname', 0)
    Set @lastname = Field(@Rowset,'lastname', 0)
EndIf

See Also