UpdateSingleSalesforceObject()

Updates a record in a Salesforce object.

When you call this function, it issues a SOAP request to your Salesforce org. As a result, the function is subject to the API limits that apply to your Salesforce org. We recommend that you minimize your 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.