
How to insert a record in Salesforce by using AMPscript?
How to insert a record in Salesforce by using AMPscript
1- First you have to create a cloud page in the Marketing Cloud
2- Use the of Ampscript code -
To insert a record in Salesforce
%%[var @createSfRecordset @createSfRecord = CreateSalesforceObject( 'Lead', 4, 'FirstName', 'rajan', 'LastName', 'gupta', 'Email', 'test2gmail.com', 'Company','xyz')]%%
NOTE- You must remember your marketing cloud org and your Salesforce Org are perfectly integrated.
In this AMPscript we have inserted a lead record in Salesforce -
Lastname : gupta
Firstname : rajan
Email: test2gmail.com
Company: xyz
NOTE - You must remember that you have to use API name fields of Salesforce objects when you are inserting the record by using Ampscript.
To create a cloud page ------>
1- Login in marketing cloud -----> Click on cloud pages -----> Click on collections
2- Create a new collection --->
3- Create a new landing page ---> Choose classic editor --> Write your Ampscript code --->
4- When your page is loaded then your record is inserted in Salesforce