Salesforce Picklist Options
Syncing dropdown field options with the picklist values of a Salesforce object's properties
Last updated
Syncing dropdown field options with the picklist values of a Salesforce object's properties
Last updated
Step 1:
Create a dropdown field with no options and is disabled by default
Navigate to your form's designer
Add a new dropdown field and give it an id.
Set its properties to Readonly, and remove the default options it has.
Step 2:
Create an API Connector that fetches the Salesforce object
Navigate to the logic page for your form.
Under the "API Connectors" tab, press Create API Connector
Choose "Custom Connector" and hit Next
Fill out the API Connector to correspond with your needs.
Use this url, but fill in your Salesforce instance url and object name: https://<YOUR_SALESFORCE_URL>/services/data/v50.0/sobjects/<YOUR_SALESFORCE_OBJECT>/describe
Add a "Authorization" header with the value "Bearer {{salesforce_token}}"
This will prompt you to choose a connected Salesforce Account to use
Hit Next and Skip
Step 3:
Create a Logic rule that uses the API Connector to set a field's options
Under the "Rules" tab, press Create Rule
Set the Trigger to "Form Step is Loaded" and choose the step to run the rule on
Switch the rule to Advanced Logic and press edit code
Paste this code in and change Industry
to the Salesforce Object field name you want, and sf_industry_dropdown
to the Field ID of your dropdown field.
You can populate multiple dropdown options by modifying the above code. You can call the setPicklistOptions function multiple times, once for each dropdown.
Result:
Now the dropdown options are pulled from Salesforce automatically, when the step is loaded.