Lead Integration Wordpress Plugin Documentation

Contents

Introduction

Thanks for purchasing VIA Studio’s Salesforce integration for Gravity Forms.

This plugin will allow you to easily map fields from a Gravity Form to a Salesforce objects. A single form can even map different fields to different objects, allowing you to easily use Gravity Forms to keep Salesforce up-to-date.


System Requirements

  • WordPress 4.x or greater
  • Gravity Forms 2.3.x or greater
  • PHP 7.1
  • Salesforce
    • You’ll need to configure a custom Connected App (see below)
    • And you’ll need a valid Salesforce username/password.

Salesforce Setup

This plugin uses a Salesforce Connect App in order to access your Salesforce installation. Please refer to the Salesforce documentation (https://developer.salesforce.com/page/Connected_Apps) for more details on Connected Apps and how they work.

This user guide will go through the basics of setting up a Connected App for use by the plugin.

First, go the Setup area of Salesforce.


Under Platform Tools, locate the App Manager.


Then click the New Connected App button.


Fill in all of the required basic information.

Make sure to enable OAuth Settings and set the Callback URL to https://salesforce.com

While you can limit the OAuth Access Scope of the app to whatever you want, Full Access may be the easiest and give you the most flexibility.


Once you’ve created the app, make note of your Consumer Key and Consumer Secret. These are needed when configuring the plugin in WordPress.


After the app is set up, click the Edit Policies button.


Make sure that Permitted Users is set to All users may self-authorize and IP Relaxation is set to Relax IP restrictions.


Plugin Setup

Once you’ve installed and activated the plugin, click Settings to configure Salesforce and your license.


Enter the license key you received when you purchased the plugin.

Next, enter your Salesforce username, password, consumer key, and consumer secret. You can also enter an optional security token if your Salesforce installation requires on.

Once everything is configured properly, you should see a message saying you’re connected to Salesforce and displaying how many API requests you have remaining.


Setting Up A Form

In this simple example, we’ll connect a Gravity Form to the Contact object in Salesforce. In GravityForms, create a basic Contact form with name, email, phone, & address fields.

Then click on Settings for your form and click Salesforce.


The plugin works by creating Feeds. Each feed will allow you to select a Salesforce object and then map the fields of that object to the fields of the GravityForm.

You can have multiple fields tied to different Salesforce object. Feeds are processed in the order they’re listed and can be rearranged by dragging and dropping.

From the Salesforce Feeds list, click Add New to create a new feed.


Give the feed a meaningful name. Since we’re mapping this feed to the Contact object, we’ll name the feed Contact.


Select the Contact object from the pulldown in Step 2. Once it’s loaded, look at the Field Settings. The pulldown on the left will contain all available Salesforce fields for the Contact object.


The pulldown on the right in Feed Settings contains all of the available fields from the GravityForm. In the example below, we’ve mapped the Email field from the GravityForm to the Email field of the Contact object in Salesforce.


Here is a complete feed which maps all of the important fields from our GravityForm back to the Salesforce Contact object.

When this form is submitted, a new Contact will be created in Salesforce.


Advanced Form Example

In this example, we’ve created a form which has Name, Email, Company Name, Company Phone, and Company Address.

We’re going to create two feeds, one which creates a new Organization object with the Company information and another which creates a new Contact object with the person’s information from the form.

Here’s the completed Company feed.


And here’s the completed Contact feed.


You can see both feeds here. Based on the current ordering, the Organization will be created in Salesforce first and then the Contact. In the next section, we’ll how to use the plugin’s custom hooks for even more advanced processing.


Developers

Hooks

The plugin has two hooks that be used for custom functionality in your theme.

viagf_after_create_sobject

The viagf_after_create_sobject hook is called after a form has been submitted and an object has been successfully created in Salesforce.

This hook receives a single argument called $options which contains the following properties:

  • Data - All data returned from the Salesforce API call, including the ID of the new object
  • Form - The instance of the Gravity Form
  • Entry - The data entered in the Gravity Form
  • Feed - The feed that was used for processing.
viagf_create_sobject_error

In the event of an error, viagf_create_sobject_error is called instead.

This hook receives a single argument called $options which contains the following properties:

  • Data - All data returned from the Salesforce API call, including the ID of the new object
  • Fields - The fields and values that were passed to the Salesforce API create call
  • Form - The instance of the Gravity Form
  • Entry - The data entered in the Gravity Form
  • Feed - The feed that was used for processing.
Filters
viagf_before_create_sobject

The viagf_before_create_sobject filter can be used to manipulate data before it is sent to Salesforce.

This filter receives the following three arguments:

  • Entry - The data entered in the Gravity Form
  • Form - The instance of the Gravity Form
  • Feed - The feed that was used for processing.

The filter expects a modified $entry to be returned which will be used for processing.


Advanced

Testing your Salesforce credentials

If you have the command-line tool cURL (http://curl.haxx.se) installed, you can verify that your connected app is working with following command:

If everything is configured properly, you should see something like the following: