Connect NinjaForms with Salesforce

Salesforce Authorization

Salesforce uses Open Authorization to connect to your Salesforce account. This process enables you to connect your WordPress site to Salesforce without having to store your Salesforce username and password in the website. You will create a “Connected App” in Salesforce, which has its own Consumer Key and Consumer Secret. This ID and Secret is what you will enter into WordPress to help you gain access to your Salesforce account.

Creating Your Connected App

Please note, if you have trouble creating your Connected App, you may need to talk to your Salesforce account support help, as Ninja Forms cannot provide detailed support for Salesforce accounts. These steps, however, should help you get quickly started:

  1. Log into your Salesforce account.
  2. Click “Setup” “Connected Apps” “New”.

New Connected App Settings

  1. Choose a Connected App name; Salesforce will generate an API name for you based on your chosen name
  2. Provide a contact email address.
  3. Select “Enable OAuth Settings”.
  4. Callback URL must be: https://login.salesforce.com/services/oauth2/success
  5. Chose the following two scopes:
    1. Access and manage your data (api).
    2. Perform requests on your behalf at any time (refresh_token, offline_access).
  6. Click “Save”.

Verify Your Connected App

Before continuing, please verify that your Connected App is set up correctly and that you have the following information:

  1. Callback URL
    1. https://login.salesforce.com/services/oauth2/success
  2. Selected OAuth Scopes
    1. Access and manage your data (api)
    2. Perform requests on your behalf at any time (refresh_token, offline_access)
  3. Consumer Key (also known as Client ID)
  4. Consumer Secret (also known as Client Secret)

Now that your Connected App has been created in Salesforce, you can go to your Ninja Forms settings to connect Ninja Forms to your Salesforce account. Connecting WordPress to your Salesforce account is a two-step process.  Generating your Consumer Key and Consumer Secret is the first step. The second step is generating an Authorization Code.  This second step ensures that only you, who can log into your Salesforce account, is authorized to use that Consumer Key and Secret.

Save Your Consumer Key and Consumer Secret in Ninja Forms

  1. In your dashboard, go to Ninja Forms Settings.
  2. Scroll to the Salesforce Settings section.
  3. Enter your Consumer Key and Consumer Secret.
  4. SAVE your settings.

Generate Your Authorization Code

  1. After saving your Consumer Key and Consumer Secret, click the link “Click to generate open authorization code”.
    • You will be redirected to Salesforce and asked to log in, if you are not already logged in.
    • After being logged in, you will then be redirected to a page that says “Remote Access Application Authorization”.
    • On this page, the URL that is in the address bar of your browser contains the authorization code you need.
  2. Copy the authorization code (the entire address) and paste it into the Authorization Code box in the Salesforce Settings.
  3. SAVE your settings.

Generate Your Refresh Token

IMMEDIATELY after saving your authorization code:

  1. Click the link “Click to generate refresh token”.
    • Ninja Forms will use your Consumer Key, Consumer Secret, and this Authorization Code to generate a Refresh Token.  This token is what now allows Ninja Forms to submit form data directly into your Salesforce account for you.

Verifying Your Authorization

Callback URL

The callback URL in your Salesforce connected app must match exactly as specified:

https://login.salesforce.com/services/oauth2/success

Open Auth Scopes

The following two scopes must be enabled in your connected app:

Access and manage your data (api)

Perform requests on your behalf at any time (refresh_token, offline_access)

Saving Your Settings

After entering your Consumer Key and Consumer Secret, SAVE your settings before continuing.

After entering your Authorization Code, SAVE your settings.

Click to generate the refresh token IMMEDIATELY after saving.

Retrieving Your Salesforce Objects and Fields

Your Salesforce account has objects (ex: Accounts, Contacts, Leads) and fields within those objects (ex: First Name, Last Name, Phone) into which you wish to send your Ninja Forms’ submissions. Once you have successfully connected to your Salesforce account by performing the authorization steps, you can retrieve your objects and fields by:

By default, the fields for the Leads object is retrieved. Below the list of fields is a complete list of all the objects you have in your Salesforce account. If you wish to use different or additional objects:

  1. Copy those objects from the object list and paste them into the “Objects to Retrieve” box, separating the objects with a comma “,”.
  2. SAVE your settings.
  3. Click the link “Click to retrieve your Objects and fields”.

The fields for your desired objects are now loaded into Ninja Forms for use in all your forms.

Mapping Your Form Fields to Salesforce

After you have created your form in Ninja Forms, the final step is to map your form fields into where you’d like them to go in your Salesforce account. Here’s how to do that:

  1. Go to the Emails & Actions section of your form design.
  2. Click “+” to add a new action.
  3. Select “Add to Salesforce”.
  4. Click “Salesforce Field Map +” to add a new field map.
  5. In the Form Field box:
    1. Click the gray icon to pull up a list of all your form fields.
    2. Select the form field you wish to use.
    3. If you want to send a specific value instead of a submitted form value, type the value directly into the box (ex: “3 days”).
  6. In the Salesforce Field, use the drop down list to select to which field in your Salesforce account you wish to send this data.
  7. (Optional) Data Handling Instructions lets you do the following:
    • Check for duplicates in this field. If Ninja Forms finds a duplicate in your Salesforce account, a task will be created to notify you of the possible duplicate.
    • Format the field as a date interval. If you want to set a date in the future based on the submission date, click this field and set the form field to the desired date interval.
    • Format the field as a date. Salesforce as a specific date format required, but this format may not be what you want to appear on your form. By selecting this option, your form value will be converted into the date format required by Salesforce.

When you are done, click “Done” and publish your form.  Your form submissions will now be sent to Salesforce. Congratulations!

Leave a Reply

Your email address will not be published. Required fields are marked *