The Salesforce integration for WS Form PRO connects forms directly to Salesforce. You can create and update Salesforce objects, run Salesforce invocable actions (Flows), upload files, detect and update duplicate records, populate forms from Salesforce, and use data returned by Salesforce in subsequent actions.
For example, you could create a Lead from a sales inquiry, update an existing Contact, attach uploaded files to an object, run a Salesforce Flow, or retrieve an existing Salesforce record and use it to populate a form.
Installation
The Salesforce add-on is installed in the same way as installing WS Form PRO.
Once installed, activate the license for the Salesforce add-on.
- Click WS Form in the WordPress administration menu.
- Click Settings.
- Open the Integrations tab and select Salesforce.
- Enter your Salesforce add-on license key in Add-on License Key.
- Click Activate.
The Add-on License Status setting confirms whether your Salesforce add-on license is active.
If your license key fails to activate, make sure you are using the license key for the Salesforce add-on and not your WS Form PRO license key.
Connecting To Salesforce
Before you can use Salesforce objects or invocable actions, WS Form needs to be connected to your Salesforce account.
- Click WS Form in the WordPress administration menu.
- Click Settings.
- Open the Integrations tab and select Salesforce.
- If required, configure the Custom Endpoint Hostname.
- Click Connect.
- Follow the Salesforce authorization prompts.
Once connected, the Salesforce Status will show that the integration is connected and the Instance URL assigned by Salesforce will be displayed.
Custom Endpoint Hostname
By default, WS Form connects using login.salesforce.com.
You can use the Custom Endpoint Hostname setting to connect through a different Salesforce login endpoint.
For example, when connecting to a Salesforce Sandbox, use test.salesforce.com.
Enter the hostname only. You do not need to include the protocol.
Working Objects
Salesforce can contain a large number of standard and custom objects. The Working Objects setting lets you choose which objects WS Form should make available.
Common Salesforce objects include Accounts, Contacts, Leads, Opportunities, Cases, and Campaigns. Custom Salesforce objects are also supported and will appear in the available object list.
Select the objects you want to use and click Save.
If you add or modify objects in Salesforce and they do not appear in WS Form, click Refresh alongside Working Objects to retrieve the latest object definitions from Salesforce.
Working Invocable Actions
In addition to working with Salesforce objects, WS Form can run supported Salesforce invocable actions.
The Working Invocable Actions setting determines which available actions can be selected in WS Form. This includes supported Salesforce Flow actions exposed through the Salesforce API.
Select the invocable actions you want to make available and click Save.
If you create or modify an invocable action in Salesforce, click Refresh alongside Working Invocable Actions to retrieve the latest actions.
Creating A Form From A Salesforce Object
WS Form can automatically create a form from a Salesforce object. Fields are created from the Salesforce object definition and the Salesforce action is configured automatically.
To create a form from a Salesforce object:
- Click WS Form in the WordPress administration menu.
- Click Add New.
- Select the Salesforce tab.
- Choose the Salesforce object you want to use.
- Wait while WS Form builds and configures the form.
The resulting form can be edited in the same way as any other WS Form form.
If an object does not appear, click the refresh icon on the Salesforce tab. You can also check that the object is selected under Working Objects in the Salesforce integration settings.
Adding A Salesforce Action Manually
You can connect any form to Salesforce by adding a Salesforce action.
- Edit the form.
- Open the Actions sidebar.
- Click Add.
- Select Add to Salesforce.
- Configure the Salesforce action.
- Click Save.
You can add multiple Salesforce actions to the same form. This makes it possible to create or update several related Salesforce objects, run invocable actions, or combine both operations from a single submission.
When Should This Action Run?
Like other WS Form actions, the Salesforce action can be configured to run when the form is saved, submitted, or both.
Opt-In Field
The optional Opt-In Field setting controls whether the Salesforce action runs according to the value of a form field.
Select a Select, Checkbox, or Radio field. If the selected field does not contain a value when the action runs, no data is sent to Salesforce.
A common use is to select a Checkbox field that asks the user for permission to send their information to a CRM.
Endpoint
The Endpoint setting determines what the Salesforce action will interact with.
- Objects – Create or update Salesforce records.
- Invocable Actions – Run supported Salesforce invocable actions, including supported Salesforce Flows.
The settings shown beneath Endpoint change according to the type of endpoint selected.
Working With Salesforce Objects
When you select a Salesforce object as the Endpoint, WS Form provides settings for creating records, updating records, mapping fields, detecting duplicates, and uploading attachments.
Object ID
The Object ID setting can be used when you already know the Salesforce record you want to update.
Leave this setting blank to create a new Salesforce record. To update a specific existing record, enter its Salesforce Object ID.
You can also use WS Form variables in this setting. This is particularly useful when multiple Salesforce actions are configured on the same form.
Field Mapping
Field Mapping determines which form fields are sent to corresponding Salesforce fields. For example, a form Email field could be mapped to the Salesforce Email field.
To create a field mapping:
- Click Add in the Field Mapping section.
- Select the WS Form field under Form Field.
- Select the corresponding Salesforce Field.
- Choose the On Update behavior.
- Repeat for each field you want to send to Salesforce.
WS Form processes values according to the Salesforce field type. This includes booleans, numbers, currency values, dates, times, date/times, references, and multi-select picklists.
Custom Mapping
Custom Mapping lets you send a fixed value or a WS Form variable to a Salesforce field without requiring a corresponding form field.
For example, you could set the Lead Source for every new Salesforce Lead to a fixed value such as Website.
- Click Add in the Custom Mapping section.
- Enter the value or WS Form variable in Value.
- Select the destination Salesforce Field.
- Choose the On Update behavior.
Find Duplicates By
The Find Duplicates By setting lets WS Form search Salesforce for an existing record before creating a new one.
Select the Salesforce field that should uniquely identify the record. For example, when creating Contacts or Leads, you might use the Salesforce Email field.
The Salesforce field selected in Find Duplicates By must also have a value supplied through your field or custom mappings.
If Duplicate Found
The If Duplicate Found setting determines what happens when an existing Salesforce record is found.
| Setting | Description |
|---|---|
| Do nothing | The existing Salesforce record is left unchanged. |
| Update | The existing Salesforce record is updated using the submitted data and the On Update rules configured for each mapping. |
On Update
Each field and custom mapping has an On Update setting that determines how that value behaves when an existing Salesforce record is updated.
| Setting | Description |
|---|---|
| Update | Replaces the existing Salesforce value with the new value. |
| Merge | Merges the existing value with the new value. This is particularly useful with Salesforce multi-select picklists. |
| Ignore | Leaves the existing Salesforce field unchanged. |
Attachment Mapping
Attachment Mapping lets you upload files from WS Form to the Salesforce object.
You can map File Upload and Signature fields.
- Click Add in the Attachment Mapping section.
- Select the file or signature field.
- Repeat for each field that should be uploaded to Salesforce.
If a File Upload field allows multiple files, each uploaded file is processed as an attachment.
Running Salesforce Invocable Actions
Salesforce invocable actions allow WS Form to send data to supported Salesforce automation, including supported Salesforce Flows.
- Add or edit an Add to Salesforce action.
- Choose the required invocable action from Endpoint.
- Configure the input mappings required by the action.
- Configure any response mappings you want returned to WS Form.
- Click Save.
The available inputs and outputs depend on how the invocable action is configured in Salesforce.
Field Mapping
When an invocable action is selected, Field Mapping maps WS Form fields to inputs exposed by the Salesforce action.
For each mapping, select the Form Field and corresponding Salesforce Action Input.
Custom Mapping
Custom Mapping can be used when an action input should receive a fixed value or a value generated using WS Form variables.
Each mapping consists of an Input Value containing the value or variable to send and an Input Key identifying the Salesforce action input that should receive it.
File Mapping
File Mapping lets you map uploaded files or signatures to compatible inputs in a Salesforce invocable action.
For each mapping, select the WS Form file or signature field and the corresponding Salesforce Action Input.
WS Form uploads the file to Salesforce and passes the resulting Salesforce Content Version ID to the action input.
Deduplicate Arrays
Enable Deduplicate Arrays if multiple mappings can add values to the same action input array.
When enabled, duplicate values in those arrays are removed before the request is sent to Salesforce.
Response Field Mapping
Salesforce invocable actions can return output values after they run. Response Field Mapping lets you store those returned values in WS Form fields.
For each response mapping, enter the Salesforce action Output Key and select the WS Form field that should receive the returned value.
For example, a Salesforce Flow could return an identifier, calculated value, status, or other result and WS Form could store that result in a field for use by subsequent processing.
Populating Forms From Salesforce
Salesforce can also be used as a Form Population data source.
This lets you retrieve data from a Salesforce object or run an invocable action when a form loads and use the returned data to populate WS Form fields.
- Edit the form.
- Open the form settings.
- Enable Form Population.
- Select Salesforce as the population action.
- Select the Salesforce object or invocable action you want to use.
- Configure the population settings and field mappings.
Populating From A Salesforce Object
When a Salesforce object is selected as the form population source, the Object ID setting specifies which Salesforce record should be retrieved.
You can enter an Object ID directly or use WS Form variables to determine it dynamically.
After selecting the object, map Salesforce fields to the WS Form fields that should be populated.
Populating From An Invocable Action
A Salesforce invocable action can also be run as part of form population. This provides settings for sending inputs to the action and mapping its outputs back to the form.
Input Mapping
Input Mapping sends values to the Salesforce invocable action. Each mapping contains an Input Value and the Salesforce Input Key that should receive the value.
The input value can contain fixed values or WS Form variables.
Output Mapping
Output Mapping maps outputs exposed by the Salesforce action to WS Form fields. Select the Salesforce Output Key and the WS Form field that should receive the returned value.
Custom Output Mapping
Custom Output Mapping lets you retrieve an output using a specific output node or path and map that value to a WS Form field.
This is useful when an invocable action returns a more complex response and you need to retrieve a specific value from that response.
Salesforce Object ID Variables
When a Salesforce object is created or an existing object is found, WS Form makes its Salesforce Object ID available to subsequent processing.
| Variable | Description |
|---|---|
#salesforce_object_id_first | Returns the first Salesforce Object ID created or found while processing Salesforce actions. |
#salesforce_object_id | Returns the most recent Salesforce Object ID created or found. |
These variables are particularly useful when multiple Salesforce actions run on the same submission.
For example, you could create a Contact and then use #salesforce_object_id in a subsequent Salesforce action to create another object associated with that Contact.
The variables can be used anywhere WS Form variables are supported.
Using Multiple Salesforce Actions
You can add multiple Salesforce actions to a single form. Actions run in sequence, making it possible to build more sophisticated Salesforce workflows.
For example, a form could create or update a Contact, create another Salesforce object related to that Contact, upload supporting files, run a Salesforce invocable action, and store values returned by that action in WS Form fields.
Salesforce Object ID variables and WS Form variables can be used to pass information between these actions.
Troubleshooting
Salesforce Objects Or Actions Are Missing
If an object does not appear in WS Form, go to WS Form > Settings > Integrations > Salesforce, check Working Objects, and click Refresh to retrieve the latest object definitions from Salesforce.
For missing invocable actions, follow the same process using Working Invocable Actions.
Salesforce Connection Has Expired
If WS Form can no longer communicate with Salesforce, go to WS Form > Settings > Integrations > Salesforce, click Disconnect, and then click Connect to re-establish the connection.
Learn more: Error: INVALID_SESSION_ID – Session Expired Or Invalid
Using A Salesforce Sandbox
If you are connecting to a Salesforce Sandbox, enter test.salesforce.com in Custom Endpoint Hostname before connecting your Salesforce account.
Refreshing Salesforce Metadata
If you change object definitions, custom fields, or invocable actions in Salesforce, refresh the corresponding metadata under WS Form > Settings > Integrations > Salesforce.
This ensures the latest Salesforce objects, fields, inputs, and actions are available when configuring your forms.