Sending Data to Salesforce

Overview

Data from the webform is sent to Salesforce by means of a mapping of webform fields, as well as hard-coded values, to fields within Salesforce objects. These mappings are reached via a "Salesforce" link on the webform editing screen. There is a dropdown there which allows the editor to choose which operation to perform. Common options are "Components", "Email", and "Form Settings." By enabling this module, a new option will be added, labeled "Salesforce. Choosing that option brings up the form to manage the mappings of data to Salesforce fields.

Multiple objects, and multiple fields within those objects, can be mapped from a single webform. Objects are created or updated in the order they appear on the mapping form. This is important, as mappings further down the list can reference objects created or updated earlier in the list. For instance, if you wanted to create a self-service portal where people could submit support cases for themselves, you might first want to create a Salesforce Contact record for that person, based on data they provide or on info from their Drupal profile, and then use the ID of that contact record as the contact associated with the new Case object created from the remainder of the data.

Mapping details

To add a new mapping, choose the desired Salesforce object from the list of all objects available to you in your instance. Once that is done, a form will be presented with the following fields:

  • The name of the map. This name is used when the map is referenced by other maps on the same form. The name must consist of only letter, numbers, and the underscore (_) character
  • The "weight" of the map. Lower numbers will be processed before higher numbers. If a given map refers to another map, then the referencing map must have a higher weight that the referenced map
  • A list of fields available for the selected object. The data collected for those fields varies based on the field type within Salesforce
    • All fields offer a text input field. In the case of text area fields in Salesforce, this will be a multi-line text area. In all other cases, it's a singe line text input
    • All fields offer a "key field" checkbox. If any fields have this checked, then the system will attempt to find a record in Salesforce where all of the key fields match the provided values. If successful, then that record will be updated, rather than a new one created. If no such record can be found, or if no fields are marked as key fields, then a new record will always be created.
    • The following fields also provide a drop down list of possible choices
      • Pick lists (the possible pick list values defined in Salesforce)
      • Boolean fields (TRUE and FALSE)
      • Reference field (a list of all objects of the type referenced)
    • Within the text fields, token substitution is performed. This is the same token substitution performed throughout the webform module, with one addition.
      • [submission:salesforce:MAPNAME] would insert the Salesforce ID created from the map named MAPNAME
      • Multiple substitutions can be performed within one field, as in this example.

Data transmission

The data defined in the maps is sent to Salesforce as soon as the submission is completed. It is also possible to force the data to be resent to Salesforce, in the event that it has been edited, or there was an error in transmission. When viewing submission results in Drupal for which there is a mapping defined, a link will be presented at the top of the page labeled "Resend to Salesforce." Clicking that link will give the form administrator the ability to resubmit the data, choosing at that time whether to updated the records previously created during the last submission, or to create new records.