UpdateSingleSalesforceObject Function

The UpdateSingleSalesforceObject function allows you to update a record in an object in Salesforce (both standard and custom objects). You need to have the connector enabled and configured correctly in order for this AMPscript function to work. You do not need to have the object synced via Synchronized Data Extensions.

Example:

					

%%[
set @id = RequestParameter(“_subscriberkey”)
set @result = UpdateSingleSalesforceObject(‘Contact’,@id,’HasOptedOutOfEmail’,’true’)
]%%

Output:

None. The Salesforce documentation for the UpdateSingleSalesforceObject function states that a 0 or 1 is returned for failure and success but I haven’t seen any values returned.

Explanation:

This is code in a CloudPage using CloudPagesURL function to send the _subscriberkey to the page.

Leave a Reply

Your email address will not be published. Required fields are marked *