Feathery Docs
HomeCommunityGitHub
  • Platform
    • Quickstart
    • Form Fields
      • Hidden Fields
      • How to Set Field Values
      • Link Fields Across Forms
      • Custom Field Input Format
    • Build Forms
      • Elements
        • Basic
          • Container
          • Button
          • Text
          • Progress Bar
          • Image
          • PDF Viewer
          • Video
          • Table
          • Tooltip
        • Fields
          • Address
            • Street Address Line 1
            • Street Address Line 2
            • City
            • State
            • Country
            • Zip Code
          • Button Group
          • Checkbox
          • Checkbox Group
          • Color Picker
          • Combobox
          • Dropdown
          • Dropdown Multiselect
          • Date Selector
          • Time Selector
          • Email
          • File Upload
          • Matrix
          • Number
          • Password
          • Picture Choice
          • Pin Input
          • Phone Number
          • Radio Group
          • Rating
          • Signature
            • Legally Binding Signatures
          • Slider
          • Social Security Number
          • Text Area
          • Text Field
          • Payment Method
          • URL
        • Custom HTML, JS, CSS, and Iframes
        • Custom Fields
      • Design
        • Reuse styles and elements
          • Styling
          • Assets
        • Alignment and Spacing
        • Sizing Forms and Elements
        • Responsive Layouts
      • Actions
      • Logic
        • Navigate Steps Conditionally
        • Show Elements Conditionally
        • Custom Field Validation
        • Available Conditions
        • Display Dynamic Text
        • Dynamically Repeating Containers
      • Advanced Logic & API Connections
        • Visual Rule Builder
          • Connect to API Action
            • Salesforce API Connector
          • Set Field Value Action
          • Navigate Step Action
          • Set Field Error Action
          • Open URL Action
          • Set Calendly URL Action
        • Javascript Rule Builder
          • API Connections in Code
          • Trigger Integrations from Logic
          • Reusable Logic Configs
        • Examples
          • API Connectors
            • Dynamic dropdown options
            • Dynamic form navigation
            • Pre-fill form from Salesforce
            • Pre-fill form from Hubspot
            • Pre-fill field options from Google Sheets
            • Generate ChatGPT Message
          • Field Validation
            • Complex Field Validation
            • Date and Time Validations
          • Initialize Date Field
          • Dynamically set field placeholder
          • Randomize Field Option Order
          • Update field options based on previous selection
      • Integrations
        • Event Triggers
        • Examples
          • Upload Files to Google Drive
      • Dev & Staging Environments
    • Launch Forms
      • Embed Your Forms
      • Custom URLs & SEO
      • User Tracking
      • Completion Criteria
      • UTM Parameters
      • Accessibility Standards
      • Analytics
      • A/B Testing
      • Offline Mode
    • Document Intelligence
      • Review Extractions
      • Post Processing
      • Supported Document Types
      • Prompting Guide
      • Examples
        • Investment Report
    • Document Autofill & Signatures
      • Autofill Document Templates
        • PDF Autofill
        • Word Doc Autofill
          • Dynamic Tables
        • Excel Autofill
        • PowerPoint Autofill
        • InDesign Autofill
      • Signature Workflows
        • Signature Notifications
        • Access Signed Documents
        • 21 CFR Part 11 Compliance
      • Export Form Submission PDF
    • Workflows
      • Collaboration
        • Email Invite
        • Start Directly
        • Anonymous Starts
      • Review, Edit & Approve
      • Unique Submission Links
    • Enterprise Compliance
      • Security and Privacy
      • Reliability and Performance
      • Document Management
      • Data Sovereignty
    • International Forms
      • Translate Forms
      • Right to Left (RTL) Support
      • International Form Fields
    • White Label Feathery
      • Build Custom Form Fields
      • Offer Custom Form Templates
      • Custom Dashboard Domain
    • Account Settings
      • Managing Your Team
      • Permissions and User Groups
      • Account Attributes
    • FAQs
      • Account & Billing
  • Guides
    • Verify Submissions & Prevent Spam
    • Build a Login or Verification Flow
      • Connect an Auth Integration
      • Add Auth Methods
        • Email SMS Code
        • Email Magic Link
        • Phone Number Verification
        • Social Logins
          • Google
          • Amazon
          • Apple
          • Bitbucket
          • Coinbase
          • Discord
          • Facebook
          • GitHub
          • GitLab
          • LinkedIn
          • Microsoft
          • Slack
          • Twitch
          • Twitter
      • (Optional) Require Auth for Onboarding Steps
      • (Optional) Add Login Flow to Your Site
        • Feathery-Hosted (Recommended)
        • Embed Login Flow
          • Login Embed Tutorial
    • Build a Payment Flow
      • Connect to Stripe
      • Select Products or Plans
      • Collect Payment Method
      • Purchase Products
    • Send Custom SMS Messages
    • Salesforce Picklist Options
  • Developers
    • React SDK
      • API Guide
        • init()
        • <Form>
          • contextRef
          • Event Handlers
            • onSubmit()
            • onLoad()
            • onChange()
            • onAction()
            • onError()
            • onFormComplete()
            • onView()
          • Custom JSX Components
          • PopupOptions
          • initialLoader
        • getFieldValues()
        • setFieldValues()
        • updateUserId()
        • Login API
          • <LoginForm>
          • useAuthClient()
      • Inline vs Popup Form
    • Javascript SDK
    • Context API
      • Field Object
      • field.setStyles()
      • Deprecated Context API
    • REST API
Powered by GitBook
On this page

Was this helpful?

  1. Guides

Salesforce Picklist Options

Syncing dropdown field options with the picklist values of a Salesforce object's properties

PreviousSend Custom SMS MessagesNextReact SDK

Last updated 6 months ago

Was this helpful?

Step 1:

Create a dropdown field with no options and is disabled by default

  1. Navigate to your form's designer

  2. Add a new dropdown field and give it an id.

  3. Set its properties to Readonly, and remove the default options it has.

Step 2:

Create an API Connector that fetches the Salesforce object

  1. Navigate to the logic page for your form.

  2. Under the "API Connectors" tab, press Create API Connector

  3. Choose "Custom Connector" and hit Next

  4. Fill out the API Connector to correspond with your needs.

    1. 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

    2. Add a "Authorization" header with the value "Bearer {{salesforce_token}}"

      1. This will prompt you to choose a connected Salesforce Account to use

  5. Hit Next and Skip

Step 3:

Create a Logic rule that uses the API Connector to set a field's options

  1. Under the "Rules" tab, press Create Rule

  2. Set the Trigger to "Form Step is Loaded" and choose the step to run the rule on

  3. Switch the rule to Advanced Logic and press edit code

  4. 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.

function setPicklistOptions(sf_fields, sf_field_name, feathery_field_name) {
  const sf_field = sf_fields.find(field => field.name === sf_field_name);
  if (!sf_field) {
    throw new Error("Could not find the Salesforce field!")
  }
  
  const picklist_values = sf_field.picklistValues;
  const options = picklist_values.map(option => option.value)
  
  feathery.fields[feathery_field_name].options = options;
  feathery.fields[feathery_field_name].disabled = false;
}

try {
  const response = await feathery.http.connect("Salesforce Describe Object");
  const fields = response.data.fields;
  
  setPicklistOptions(fields, "Industry", "sf_industry_dropdown");
  // Call setPicklistOptions() for more fields here
} catch (error) {
  console.log(error.message)
}

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.

Dropdown field
API Connector