RetrieveMSCRMRecordsFetchXML
This function accepts a Fetch XML string and returns the specified Microsoft Dynamics CRM entity attributes.
Argument
RetrieveMSCRMRecordsFetchXML(1)
Ordinal | Type | Required | Description |
---|---|---|---|
1 | String | True | Fetch XML string |
Example
%%[
var @i
var @XML
var @records
var @rowcount
var @subscriberKey
set @subscriberKey = AttributeValue("_subscriberkey") /* value from attribute or DE column in send context */
set @subscriberKey = "a0e0ba6d-c4a2-4b06-b94d-1db3b5c6aec1" /* or a literal value */
set @XML = ""
set @XML = concat(@XML, "<fetch mapping='logical' count='1' version='1.0'>")
set @XML = concat(@XML, " <entity name='contact'>")
set @XML = concat(@XML, " <attribute name='contactID'/>")
set @XML = concat(@XML, " <attribute name='emailAddressString'/>")
set @XML = concat(@XML, " <attribute name='firstName'/>")
set @XML = concat(@XML, " <attribute name='lastName'/>")
set @XML = concat(@XML, " <filter>")
set @XML = concat(@XML, " <condition attribute='contactID' operator='eq' value='", @subscriberKey, "'/>")
set @XML = concat(@XML, " </filter>")
set @XML = concat(@XML, " </entity>")
set @XML = concat(@XML, "</fetch>")
set @records = RetrieveMSCRMRecordsFetchXML(@XML)
set @rowCount = rowcount(@records)
for @i = 1 to @rowCount do
var @record
var @contactID
var @emailAddressString
var @firstName
var @lastName
set @record = row(@records,@i)
set @contactID = field(@record, "contactID")
set @emailAddressString = field(@record, "emailAddressString")
set @firstName = field(@record, "firstName")
set @lastName = field(@record, "lastName")
output(concat("<br>contactID: ", @contactID))
output(concat("<br>emailAddressString: ", @emailAddressString))
output(concat("<br>firstName: ", @firstName))
output(concat("<br>lastName: ", @lastName))
next @i
]%%
Output
contactID: a0e0ba6d-c4a2-4b06-b94d-1db3b5c6aec1
emailaddresString: curt@limedash.com
firstName: Curt
lastName: Harris