Skip to main content

Salesforce

What it does​

Creates a lead in Salesforce from each new submission of a form. If the form says which campaign the lead belongs to, the lead is also added to that campaign.

What Salesforce receives:

  • the email address;
  • the first and last name. They come from the customer account when a signed-in customer sends the form. For a guest, the submitter name of the form goes in the last name, or Guest when the form has none. See Submission Identity in Form settings;
  • the company, which is a dash (-) unless you map a field to it, because Salesforce requires one;
  • the fields you map.

Answers you don't map aren't sent.

Install​

composer require mageme/module-webforms-addon-salesforce
bin/magento setup:upgrade

Settings​

Connect your Salesforce account​

Go to Stores → Configuration → MageMe Extensions → WebForms, expand Integrations, then Salesforce. Enter the Consumer Key and Consumer Secret of the connected app you created in Salesforce, and the Username and Password of the Salesforce user that creates the leads. Click Save Config. The connection is the same for every store view. See Settings: Integrations for the duplicate protection settings.

Leads are created as this Salesforce user. Use a user whose access you're happy to store in Magento.

Choose what a form sends​

  1. Go to Content → WebForms → Manage Forms and click the form's name.
  2. Under Form Information, click Salesforce Integration Settings.
  3. Select Yes in Enable Salesforce Integration.
  4. In Customer Email, keep Default or pick the form's email field. Default is the address in the form's Submitter Email setting, or the customer account's address.
  5. Under Fields Mapping, click Add for each lead field you want to fill. Pick it in Salesforce Lead Attribute and the form field in Field.
  6. Click Save.

Salesforce Lead Attribute always offers the standard lead fields, such as First Name, Company, Phone and Country. Your own lead fields appear under Custom Fields after you click Refresh Lists in the section, on a saved form with the account connected.

To add the leads of a form to a campaign, add a Hidden field with the code campaignId and put the campaign's id in its Hidden Field Value. The lead's campaign status is Responded. For another status, add a second Hidden field with the code status and the status in its Hidden Field Value. See Hidden field.

How it works​

When a visitor submits the form, WebForms saves the submission and then queues it for Salesforce. The queue is worked through by Magento's scheduled tasks (cron), so the lead appears in Salesforce shortly after the visit. A form set to Do Not Store Submissions sends during the visit instead. Editing a submission later doesn't send it again. A submission without an email address is skipped.

To send submissions that already exist, or to send one again:

  1. Go to Content → WebForms → Manage Forms.
  2. In the form's row, click Select in the Actions column, then click Browse Results.
  3. Select the checkboxes of the submissions.
  4. Click Actions, then Create Salesforce Lead, and confirm.

WebForms reports how many submissions were sent, skipped and failed. Create Salesforce Lead is in the menu only while the integration is on for the form and all four connection settings are saved, and only for admins with the Edit Result permission.

A repeated send creates a second lead unless Deduplicate Leads by External Key is Yes in the store configuration.

To check that it worked, look for the lead in Salesforce. WebForms doesn't mark a submission as sent.

Troubleshooting​

  • Nothing reaches Salesforce. Check that Enable Salesforce Integration is on for the store view the form was sent from and that the four connection settings are saved. Ask whoever runs your server to check that Magento cron is running and to search Magento's system log for "Salesforce" in any letter case. The lines about sending start with "WebForms integration" and name the service in lowercase, as salesforce. A skipped submission is logged with the reason, such as "Salesforce consumer key not configured".
  • Every submission fails with "Exception(400)". When Salesforce refuses the connection details, the log shows only "WebForms integration: delivery failed, will retry (Exception(400))" for salesforce, twice, and then "delivery failed, giving up (Exception(400))". The number is the code of Salesforce's answer, so it can differ. The line doesn't say that the sign-in was refused, and WebForms tries three times although the details can't pass. Nothing in the admin shows it afterwards, only the log. Check the four connection settings, save, and send the waiting submissions again from the list.
  • Salesforce refused the lead, for example because a required lead field is empty. WebForms doesn't try again. Map a form field to the missing lead field, save, and send the submission again from the list.
  • The lead was created but isn't in the campaign. The error is in the log; the lead isn't sent again. Check the id in the campaignId field and add the lead to the campaign in Salesforce.
  • Salesforce didn't answer, or answered with a server error. WebForms tries again, up to three tries in all, waiting longer before each one. After the third failure it gives up and writes an error to the log.

What's next​

Applies to WebForms 4Last reviewed November 24, 2026