Links

Pre-fill form from Salesforce

Use a user email to pull their Salesforce data and pre-fill form fields

Overview

This rule runs after a user email is collected on Step 1 and the step is submitted. The email is used to query a Salesforce instance to fetch other information about the user to prefill onto Step 2.
This pattern can be used to look up any Salesforce standard or custom objects based on any field or combination of fields (email, Salesforce ID, etc.)

Rule Logic

// Get user's entered email
const email = salesforceEmail.value;
const query = `SELECT Id, Name, AccountId FROM Contact WHERE Email='${email}' LIMIT 1`;
const API_ENDPOINT = `https://feathery2-dev-ed.develop.my.salesforce.com/services/data/v50.0`;
// Issue request to Salesforce to fetch contact data
const data = await feathery.http.GET(`${API_ENDPOINT}/query?q=${encodeURIComponent(query)}`);
const record = data.records[0];
// Update Feathery fields with data pulled from Salesforce
salesforceName.value = record.Name;
salesforceAccount.value = record.AccountId;

API Connector

Under the API connectors tab, create a connector with the following configuration:
Feathery will automatically detect and populate your Salesforce token in the header when you have Salesforce turned on in the Integrations tab.

Demo