Introducing WFFM to Salesforce Connector

January 31, 2017

Blog | Development | Introducing WFFM to Salesforce Connector
Introducing WFFM to Salesforce Connector

At GeekHive, we are finding that an increasing number of our customers are asking for an integration with Salesforce.  Often, they are looking for submitted form data to automatically be imported into Salesforce.  For our customers running Web Forms For Marketers, we have created WFFM to Salesforce Connector: WffmToSalesforce .  

Web Forms for Marketers (WFFM) to Salesforce Connector in the Sitecore Marketplace

A search of “Salesforce” in the Sitecore Marketplace reveals several existing modules, yet none of them perform the simple operation of sending submitted form data to Salesforce in an easy to follow, extensible manner.  This was the reasoning behind creating WffmToSalesforce.

It is worth noting that a pay-for module exists from Fuse IT.  This module goes above and beyond what WffmToSalesforce is able to do, but is not open source… like WffmToSalesforce:

Bitbucket currently hosts a Mercurial repository.  Developers – we welcome changes by the community, feel free to review and update as you deem fit.  WffmToSalesforce uses the Partner WSDL from Salesforce.  This API provides near-full access to Salesforce.

Jump To Use-Case

Jump to Extending WffmToSalesforce

Installation of WFFM to Salesforce Connector

*Web Forms For Marketers must be installed as a prerequisite*

  1. Install WffmToSalesforce module
  2. Obtain Salesforce Security Token
  3. Create a patch config file, preferably called “zWffmToSalesforce.config” (‘z’ to ensure it is loaded after the native WffmToSalesforce.config)
    1. See example Patch:Config below
    2. Enter relevant user data
    3. Depending on environment, enter the proper EndPoint
      1. Test:
      2. Production:
      3. NOTE: Version, i.e. 38.0/39.0 may differ for your version
  4. Navigate to Content Editor within Sitecore
    1. Add /sitecore/templates/WffmToSalesforce/SalesforceForm to Base Templates field of /sitecore/templates/Web Forms for Marketers/Form
    2. Add /sitecore/templates/WffmToSalesforce/SalesforceField to Base Templates field of /sitecore/templates/Web Forms for Marketers/Field
    3. Publish all WFFM Templates, WffmToSalesforce Templates, and /system/modules/Web Forms For Marketers


<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="">
     <setting name="Salesforce.Username">
       <patch:attribute name="value">MYUSERNAME</patch:attribute>
     <setting name="Salesforce.Password">
       <patch:attribute name="value">MYPASSWORD</patch:attribute>
     <setting name="Salesforce.SecurityToken">
       <patch:attribute name="value">MYTOKEN</patch:attribute>
     <setting name="Salesforce.PartnerWsdl.EndPoint">
       <patch:attribute name="value"></patch:attribute>
       <!-- optional, if you need additional logic to be performed prior to sending data to Salesforce -->
       <processor mode="on" type="MyAssembly.MyProcessor,MyAssembly" method="Execute" patch:before="*[@type='WffmToSalesforce.Connector.Pipeline.SendToSalesforceProcessor, WffmToSalesforce.Connector']" />


Navigate to a form item in Sitecore.  Locate the Salesforce > Salesforce Object field that is now present on the item:

Introducing WFFM to Salesforce Connector example

This field should contain a list of objects from Salesforce.  Select the appropriate object that you wish to be created upon successful submission of this form.

With the selected Salesforce object in mind, create/edit the fields on the form that map to the Salesforce object.  Keep in mind that all required fields must be mapped or later patched in via the wffm2Sf.sendToSalesforce pipeline in order to successfully create the object in Salesforce.  To determine which fields are required, login to Salesforce and view the object type in question.  Required fields will have a red indicator next to them.

Introducing WFFM to Salesforce Connector example

After all fields have been mapped, navigate back to the form item in Sitecore and select Forms (Tab) > Save Actions.  Select the Send To Salesforce Save Action.

Introducing WFFM to Salesforce Connector example

Lastly, publish form changes and verify submissions are being created properly.

Adding Custom Salesforce Drop Down Field to Form

WffmToSalesforce contains a custom WFFM field type that may be used to pull data from Salesforce to display as a drop-down for a user on the form.

  1. From Content Editor, create/edit a WFFM field
  2. In the Field Link field, set the value to sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/List Types/Salesforce Drop List
  3. Set the Parameters field
    1. The Parameters field is looking for two parameters enclosed with “<>”
    2. <SalesforceQuery>
      1. This parameter accepts any Salesforce Query
    3. <SalesforceFieldName>
      1. This parameter must match an option that is returned by the SalesforceQuery parameter


Introducing WFFM to Salesforce Connector example

This data will then be shown to the user on the form, and will be consumed as raw text by the WFFM engine.

Extending WffmToSalesforce

WffmToSalesforce was built to be developer friendly.  This is primarily why we have made the entire project open source.

Since every implementation will have slight nuances, we have chosen to use a pipeline for sending the form data to Salesforce.  This allows developers to inject custom code that alters the form signature prior to sending to Salesforce.  The default action is to create a new object, but this pipeline could be extended to update an existing object, or perform other CRUD operations that are required.

The pipeline in question is wffm2Sf.sendToSalesforce.  This pipeline processes an object of type WffmToSalesforcePipelineArgs.  This class contains two public properties that are used to process the result:

  public string SObjectname { get; set; }
  public Dictionary<string,string> SObjectFields { get; set; }

These are the only two parameters required to create an object in Salesforce.

Wrapping Things Up – A note for Developers

We at GeekHive have used the WFFM to Salesforce Connector module with great success.  We hope others can benefit from it as well.  If you have any questions or comments on the module, please leave them on the Marketplace and we will address them as soon as possible.

John Rappel

.NET Practice Lead
  • Innovation
  • Salesforce
  • Sitecore
  • Tutorial
subscribe to GeekHive's newsletter

Never miss out on a Sitecore update again!

Our newsletter features a blog roundup of our top posts so you can stay up to date with industry trends, tutorials, and best practices.

Recent Work

Check out what else we've been working on