UpsertMscrmRecord()
Upserts a Microsoft Dynamics CRM record.
This function retrieves a single record from Microsoft Dynamics CRM, using the name and value parameters to filter the results. It then sorts the results. If the function finds a matching record, it updates the record with the provided name and value. If the function doesn’t find a record, it creates one using the provided name and value.
The UpsertMscrmRecord()
function has nine parameters:
entityName
(string): Required. The name of the Microsoft Dynamics CRM entity to upsert.sortField
(string): Required. The field to sort the retrieve results on.sortType
(string): Required. The order to use to sort the retrieve results. Accepted values:ASC
(ascending) orDESC
(descending).numPairsForRetrieve
(string): Required. The number of name-value pairs used to retrieve results.filterAttributeName
(string): Required. The name of the attribute to filter the target entity by.filterAttributeValue
(string): Required. The value of the attribute to filter the target entity by.numPairsForUpdate
(string): Required. The number of name-value pairs used to update records.updateAttributeName
(string): Required. The name of the attribute to update in the target entity.updateAttributeValue
(string): Required. The value of the attribute to update in the target entity.
This example first checks to see if an account exists where the name equals “MarketingCloud”. If there is, it finds the one created most recently and sets the address1_city of that record to “Indianapolis.” If there isn’t, it creates a record where the name is “MarketingCloud” and the address1_city is “Indianapolis.”
The function returns the GUID of the updated or created record.