Salesforce (Dot Com) - XML/JSON - Add Lead

Custom integration that creates/updates contacts directly in a client's Salesforce instance.

Step 1


Ask the client to setup their credentials to their console you can provide the following URL with the placeholder replaced



Within the Custom Category the client needs to create three new entries (suggested labels Salesforce API Credentials, Salesforce User Credentials, Salesforce Auth URL).


In the first entry (Salesforce API Credentials) they place their clientID as username and the clientSecret as Password.

In the second entry (Salesforce User Credentials) they place the email as username and the password as password of an authorized user.

In the third entry (Salesforce Auth URL) they place their instance specific URL as username e.g.: https://{instancename}} And enter a placeholder like - in the password field


Example: Salesforce API Credentials

Example: Salesforce User Credentials

Example: Salesforce Auth URL

Step 2


Setup the Fieldmapping based on the Worksheet provided by the client. And adjust the demo form in their console to match all the fields they want to collect.


Example: Salesforce (DotCom) - Add Lead field mapping


As this is a POST XML/JSON integtration also the JSON part will need to be adjusted for every field added.

Note: The access_token is not mapped directly in the JSON but is a dynamic variable  in the integration settings. However it is added to the fieldmapping to prevent submissions if it is missing.


Example: Salesforce (DotCom) - Add Lead settings


Recommendation: In order to keep Fieldmappings as flexible as possible only make the e-mail address required. This tends to allow the fieldmapping to be reused with a lot of variations of form in creative.


In order to dispel the concerns of the client. Fields can still be made required in the form in the creative to make sure all data they want is collected

Step 3


Setup the Integration using the Fieldmapping created in the previous step.

  • Ensure the Method for this call is set to POST
  • Add the HTTP content type as application/json
  • Add the additional HTTP Header
    • Using Authorization as name
    • Using Bearer {{access_token}} as value


Example: Salesforce (DotCom) - Add Lead

Step 4

Server Scriptlet

Create a new Server scriptlet in their console.

You should be able to directly copy the code from the Server Scriptlet Example.

Depending on the names chosen for the credentials and the integrations itself the lines 2,3 and 4 might need to be updated to match the chosen names.


Example: Salesforce (DotCom) - Auth/RunIntegration


When triggered the scriptlet is running a request to the URL provided in the Credential Set Salesforce Auth URL using the clientID and clientSecret from Salesforce API Credentials and the username and password provided in Salesforce User Credentials.

And then triggers the integration named on line 5 e.g.: Salesforce (DotCom) - Add Lead

Step 5


Add the trigger for the Server Scriptlet. This is usually the submit button on the form. But can be placed anywhere that allows you to add Rules to an action or a Page.


Example: Salesforce (DotCom) - Add Lead


Note: The Mark to re-run rule is integrated in the server scriptlet on line 61 (actionMarkReexport)

Footer Headline Goes Here

Address, State, Country