UpdateSingleSalesforceObject()
Updates a record in a Salesforce object.
To use this function, you must use Marketing Cloud Connect to integrate with Sales Cloud or Service Cloud.
When you call this function, it issues a SOAP request to your Salesforce org. SOAP API requests aren’t subject to the API usage limits that apply to your org.
For best performance, we recommend that you minimize the use of this function in sends. Using this function in large sends can result in the sends failing to complete.
The UpdateSingleSalesforceObject()
function has four parameters:
objectName
(string): Required. The API name of the Salesforce object to update.idToUpdate
(string): Required. The ID of the record to update.fieldName
(string): Required. The name of the field to update.fieldValue
(string): Required. The value to assign to the named field.
This example updates the Email field on the Lead with ID 00Q00003yAEj to contain pooja.chatterjee@example.com. If the function successfully updates the specified record, it returns 1
; otherwise, it returns 0
.
The example outputs a message that tells you whether it successfully updated the record.
When you preview code in a webpage or message that uses this function, the function performs an update as it was triggered during a send. To prevent previews from updating live data, use the _messagecontext
system variable to stop the content from being loaded in the preview context.