The CreateSalesforceObject function creates a record in an object in Salesforce (both standard and custom objects). The ID of the record is returned. 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.
A simple use case is using the
CreateSalesforceObject function in a CloudPage where you may want a record created after a form submit on the CloudPage.
CreateSalesforceObject(1,2,3,4) 1 = Salesforce Object: Account, Contact, Lead, Opportunity (or custom object) 2 = Number of fields to add to record (Include required fields) 3 = Field name to use 4 = Value of field (Can be variables)
%%[ var @createContact, @firstName, @lastName, @emailAddress set @createContact = CreateSalesforceObject(‘Contact’, 3, ‘FirstName’, @firstName, ‘LastName’, @lastName, ‘Email’, @emailAddress) ]%%
CreateSalesforceObject function is used to create a record in Sales or Service Cloud that is integrated with Marketing Cloud. The
@createContact variable is used in the create function to create a record on the
Contact object. The fields we want to create in
Contact are the