Skip to main content
RapidDev - Software Development Agency
retool-integrationsRetool Native Resource

How to Integrate Retool with Salesforce

Connect Retool to Salesforce using Retool's native Salesforce connector. Navigate to the Resources tab, add a Salesforce resource, authenticate via OAuth 2.0, and start writing SOQL queries to read leads, opportunities, and accounts. Build executive dashboards combining Salesforce CRM data with internal databases, enable CRUD operations, and access custom Apex REST endpoints directly from the Retool query editor.

What you'll learn

  • How to create a Salesforce resource in Retool using OAuth 2.0 authentication
  • How to write SOQL queries in Retool's query editor to fetch leads, opportunities, and accounts
  • How to build CRUD operations for updating and creating Salesforce records
  • How to call custom Salesforce Apex REST endpoints from Retool
  • How to build an executive CRM dashboard combining Salesforce data with internal database metrics
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate17 min read20 minutesMarketingLast updated April 2026RapidDev Engineering Team
TL;DR

Connect Retool to Salesforce using Retool's native Salesforce connector. Navigate to the Resources tab, add a Salesforce resource, authenticate via OAuth 2.0, and start writing SOQL queries to read leads, opportunities, and accounts. Build executive dashboards combining Salesforce CRM data with internal databases, enable CRUD operations, and access custom Apex REST endpoints directly from the Retool query editor.

Quick facts about this guide
FactValue
ToolSalesforce
CategoryMarketing
MethodRetool Native Resource
DifficultyIntermediate
Time required20 minutes
Last updatedApril 2026

Why Connect Retool to Salesforce?

Salesforce holds the authoritative record of your company's sales pipeline, customer relationships, and revenue data — but Salesforce's own reporting UI is slow, rigid, and locked behind per-seat licensing. Retool lets your ops team, sales managers, and engineers build custom internal dashboards and data-entry panels against Salesforce without requiring every user to have a Salesforce license or navigate Salesforce's complex interface.

The native Salesforce connector in Retool supports the full Salesforce platform: SOQL queries for flexible data retrieval, standard CRUD operations via the Salesforce REST API, bulk API access for high-volume record updates, and custom Apex REST endpoints for business logic you've already built in Salesforce. You can join Salesforce query results with internal database data using Retool's JavaScript transformers — for example, combining Salesforce opportunity records with your internal invoicing database to build a unified revenue dashboard.

Common use cases include executive dashboards displaying pipeline health and forecasting accuracy, internal tools for SDRs to bulk-update lead statuses, operations panels for managing account assignments, and support tooling that surfaces Salesforce case history alongside your own ticket data. The OAuth 2.0 integration means credentials are managed securely per-user or shared at the organization level, depending on your access control requirements.

Integration method

Retool Native Resource

Retool includes a dedicated Salesforce connector that handles OAuth 2.0 authentication, SOQL query execution, and CRUD operations natively. You configure the resource once in Retool's Resources tab and can immediately write SOQL queries against any Salesforce object — Leads, Opportunities, Accounts, Cases, and custom objects alike. Retool proxies all requests server-side, so Salesforce credentials never reach the browser.

Prerequisites

  • A Salesforce account with System Administrator or sufficient API access permissions
  • A Retool account (Cloud or self-hosted) with permission to create Resources
  • Understanding of SOQL (Salesforce Object Query Language) basics
  • For custom Connected App: a Salesforce developer or admin to configure OAuth settings
  • For bulk API or Apex: Salesforce API access enabled on your org (Enterprise edition or higher)

Step-by-step guide

1

Add a Salesforce Resource in Retool

Open your Retool instance and click the Resources tab in the left sidebar. Click Add Resource and scroll to the CRM & Sales section, or search for 'Salesforce' in the search box. Select the Salesforce connector. Retool's Salesforce connector supports two OAuth 2.0 authentication paths. The first is Retool's pre-configured OAuth app, which is the simplest option — you click Connect to Salesforce and Retool handles the OAuth handshake using its own Salesforce Connected App. The second option is a Custom Connected App, which you configure in Salesforce Setup for tighter control over OAuth scopes and callback URLs. For most teams, the pre-configured option is sufficient. Click Connect to Salesforce, and Retool will redirect you to Salesforce's OAuth authorization page. Log in with your Salesforce credentials and click Allow to grant Retool access. You'll be redirected back to Retool with the connection authenticated. For production environments where you need fine-grained OAuth scope control: in Salesforce Setup, navigate to App Manager → New Connected App. Set the callback URL to your Retool instance's OAuth callback URL (shown in the Retool resource configuration panel). Select the API scopes your Retool app needs (typically: api, refresh_token, offline_access). Copy the Consumer Key and Consumer Secret back into Retool's resource configuration under the Custom OAuth App option. Name the resource something descriptive like 'Salesforce Production' or 'Salesforce Sandbox' to distinguish environments. Click Create Resource. Retool will verify the connection and display a success message.

Pro tip: If your organization uses Salesforce Sandbox environments for development, create separate Retool resources for production and sandbox. In the resource configuration, toggle 'Use Salesforce Sandbox' to connect to your test.salesforce.com environment instead of login.salesforce.com.

Expected result: A Salesforce resource appears in your Resources list with a green Connected status indicator. You can now create queries against this resource.

2

Write your first SOQL query in the Retool query editor

Open a Retool app (or create a new one) and click the + button in the Code panel at the bottom of the screen. Select your Salesforce resource from the dropdown. The query editor will open in Salesforce mode. Retool's Salesforce query editor supports two modes: SOQL mode for reads, and Action mode for writes (Create Record, Update Record, Delete Record, and Bulk operations). For your first query, leave the mode on SOQL. Write a SOQL query to fetch open opportunities. SOQL syntax is similar to SQL but queries Salesforce Objects instead of database tables. Object names are CamelCase (Opportunity, Lead, Account, Contact, Case). Field names use the same casing as defined in Salesforce. Dynamic parameterization works the same as in Retool SQL queries: use {{ }} expressions to reference component values. For example, to filter by a date range selected in a DateRangePicker component, reference {{ dateRange.startDate }} and {{ dateRange.endDate }}. Save the query with a meaningful name like getOpenOpportunities. Click Run to verify it returns data. In the Response panel below the query editor, you'll see the raw Salesforce API response with a records array containing the matched objects.

getOpenOpportunities.soql
1SELECT
2 Id,
3 Name,
4 StageName,
5 Amount,
6 CloseDate,
7 Probability,
8 Owner.Name,
9 Account.Name,
10 CreatedDate
11FROM Opportunity
12WHERE StageName != 'Closed Won'
13 AND StageName != 'Closed Lost'
14 AND CloseDate >= {{ moment(dateRange.startDate).format('YYYY-MM-DD') }}
15 AND CloseDate <= {{ moment(dateRange.endDate).format('YYYY-MM-DD') }}
16ORDER BY CloseDate ASC
17LIMIT 200

Pro tip: SOQL does not support SELECT *. You must explicitly list the fields you want to retrieve. Use Salesforce's Object Manager or the Schema Builder in Salesforce Setup to discover available field API names. Relationship fields like Owner.Name and Account.Name fetch related record data in a single query.

Expected result: The query returns a response with a 'records' array. Each record contains the fields you specified, including nested relationship data for Owner and Account.

3

Bind Salesforce query results to Retool Table and Chart components

Now that your SOQL query is returning data, bind it to UI components. In the Component panel on the right side of the Retool editor, drag a Table component onto the canvas. With the Table selected, go to the Data property in the right-hand properties panel. Set it to {{ getOpenOpportunities.data.records }}. The Salesforce API wraps results in a 'records' array, so you must reference .data.records (not just .data) to get the array of opportunity objects. Retool will auto-populate columns based on the field names in your SOQL query. You can rename columns in the Table's column configuration panel, change their types (text, currency, date, percentage), and hide system fields like attributes that Salesforce adds automatically. To build a pipeline summary, add a JavaScript transformer query. Name it opportunitySummary. This transformer will calculate aggregate metrics from the raw SOQL results and return a structured object that KPI Card components can reference. For a pipeline chart, drag a Chart component onto the canvas. Set its data to {{ opportunitySummary.data.byStage }} and configure a bar chart showing stage names on the X axis and total value on the Y axis. Add filter components: a Select dropdown for StageName (set options to the SOQL-valid stage names), a DateRangePicker for CloseDate range, and a TextInput for searching by Account name. Wire these to your SOQL query's {{ }} parameters. Each time a filter changes, Retool re-runs the query automatically.

opportunitySummary.js
1// opportunitySummary transformer
2// Input: getOpenOpportunities.data.records (array of Salesforce Opportunity objects)
3
4const records = getOpenOpportunities.data.records || [];
5
6// Group by stage
7const byStage = records.reduce((acc, opp) => {
8 const stage = opp.StageName;
9 if (!acc[stage]) acc[stage] = { stage, count: 0, totalValue: 0 };
10 acc[stage].count += 1;
11 acc[stage].totalValue += opp.Amount || 0;
12 return acc;
13}, {});
14
15const stageArray = Object.values(byStage).sort((a, b) => b.totalValue - a.totalValue);
16
17// Total pipeline metrics
18const totalPipeline = records.reduce((sum, opp) => sum + (opp.Amount || 0), 0);
19const avgDealSize = records.length > 0 ? totalPipeline / records.length : 0;
20
21return {
22 byStage: stageArray,
23 totalPipeline: `$${(totalPipeline / 1000000).toFixed(2)}M`,
24 dealCount: records.length,
25 avgDealSize: `$${Math.round(avgDealSize).toLocaleString()}`
26};

Pro tip: Salesforce returns relationship data as nested objects. For example, Owner.Name comes back as opp.Owner?.Name in the records array. Use optional chaining (?.) in transformers to safely access nested fields without null reference errors.

Expected result: A Table displays all open opportunities with formatted columns. KPI cards show total pipeline value, deal count, and average deal size. A Chart component renders a bar chart breaking down pipeline by stage.

4

Implement CRUD operations: Update and Create Salesforce records

Retool's Salesforce resource supports Create Record, Update Record, Delete Record, and Bulk operations in addition to SOQL. These are configured in Action mode in the query editor. To update an opportunity's stage from the Table: create a new query named updateOpportunity. Switch the query type from SOQL to Action. In the Action dropdown, select Update Record. Set Object Type to Opportunity. Set Record ID to {{ table1.selectedRow.data.Id }} (referencing the Table's selected row). In the Fields to Update section, add StageName with a value of {{ stageSelect.value }}. Back in the Table component properties, set an Action Column with a button labeled 'Update Stage'. Set the button's onClick event handler to trigger the updateOpportunity query. Chain the success event: in the updateOpportunity query's Event Handlers section, add an On Success handler that triggers getOpenOpportunities to refresh the Table data. To create a new lead from a form: add a Form component. Configure text input fields for FirstName, LastName, Company, Email, Phone, and LeadSource. Create a query named createLead with Action type Create Record, Object Type Lead. Map each form field to the corresponding Lead field: FirstName → {{ form1.data.FirstName }}, etc. Connect the form's Submit button to trigger the createLead query. For high-volume operations, Retool's Salesforce connector supports the Bulk API. Use the Bulk Query action type for SOQL queries returning more than 2,000 records, which bypasses Salesforce's standard API governor limits. Bulk operations are asynchronous — Retool polls for completion and returns results when the job finishes.

updateOpportunity_fields.json
1// updateOpportunity query configuration (Action mode)
2// Object Type: Opportunity
3// Action: Update Record
4// Record ID: {{ table1.selectedRow.data.Id }}
5// Fields:
6{
7 "StageName": "{{ stageSelectDropdown.value }}",
8 "Amount": "{{ parseFloat(amountInput.value) }}",
9 "CloseDate": "{{ closeDatePicker.value }}",
10 "NextStep": "{{ nextStepInput.value }}"
11}

Pro tip: Always add a confirmation Modal before destructive operations like Delete Record or bulk stage changes. Use Retool's Modal component: set the Delete button's onClick to open the modal, then put the actual delete query trigger on the modal's Confirm button. This prevents accidental data modifications in production Salesforce.

Expected result: Clicking Update Stage in the Table opens a dropdown to select the new stage, runs the updateOpportunity query, and the Table refreshes to show the updated record. The createLead form successfully creates a new Lead record visible in Salesforce.

5

Call custom Apex REST endpoints and configure advanced settings

If your Salesforce org has custom Apex REST classes (server-side business logic you've already built in Salesforce), you can call them from Retool using the REST API action type in the Salesforce resource. In the query editor, switch Action Type to REST API. This exposes HTTP method, endpoint path, headers, and body fields. Custom Apex REST endpoints are accessible at the path /services/apexrest/YourEndpointName. For example, if you have an Apex class decorated with @RestResource(urlMapping='/quotes/*'), you can call it at /services/apexrest/quotes/. For accessing Salesforce's standard REST API directly (for endpoints not covered by Retool's built-in action types): the REST API action type also works. For example, the Salesforce Reports and Dashboards API is accessible at /services/data/v59.0/analytics/reports. To configure connection-level settings: open the Salesforce resource editor. In the Advanced settings section, you can set the Salesforce API version (default is latest — lock this for production stability), enable debug logging for troubleshooting, and configure the OAuth credential sharing policy. For teams with strict access control requirements: Retool's Salesforce resource supports per-user OAuth tokens by default (each team member authenticates individually against Salesforce). For service-account-style shared access, enable 'Share OAuth 2.0 credentials between users' in the resource settings. Use this carefully — it means all Retool users operate under the same Salesforce user session, which may have audit log implications. For complex integrations combining multiple Salesforce resources, internal databases, and Retool Workflows for background sync jobs, RapidDev's team can help architect and build your complete Retool solution.

apexRestCall.json
1// Example: Call custom Apex REST endpoint
2// Action Type: REST API
3// Method: POST
4// Path: /services/apexrest/calculateQuote
5// Body:
6{
7 "opportunityId": "{{ table1.selectedRow.data.Id }}",
8 "discountPercent": "{{ discountSlider.value }}",
9 "includeAddOns": "{{ addOnsCheckbox.value }}"
10}
11
12// Example: Fetch Salesforce analytics report data
13// Method: GET
14// Path: /services/data/v59.0/analytics/reports/{{ reportIdInput.value }}
15// Returns: report metadata and factMap with row data

Pro tip: When working with Salesforce API versions, check Salesforce's release notes for breaking changes between versions. Set the API version explicitly in your Retool Salesforce resource (e.g., v59.0) rather than using 'latest' to avoid unexpected behavior after Salesforce's triannual release schedule.

Expected result: Custom Apex REST endpoints return JSON responses that can be bound to Retool components or processed through transformers. The Salesforce resource is fully configured and ready for use across all app queries in your organization.

Common use cases

Build an executive pipeline dashboard

Create a Retool dashboard that queries Salesforce opportunities grouped by stage, owner, and close date. Add Chart components showing pipeline value by month, a Table displaying all open opportunities with inline editing for stage and amount, and a summary section with total ARR and win rate metrics calculated via JavaScript transformer.

Retool Prompt

Build an executive Salesforce dashboard showing open opportunities grouped by stage (Prospecting, Qualification, Proposal, Closed Won, Closed Lost), with a bar chart of pipeline value by close month, a filterable table of all opportunities with owner name, account name, amount, and close date, and KPI cards for total pipeline value, average deal size, and win rate.

Copy this prompt to try it in Retool

Create a lead management and bulk update panel

Build a Retool app where SDRs can search Salesforce leads by status, owner, or lead source, view lead details in a side panel, and update lead status in bulk using Retool's Table bulk edit feature combined with Salesforce's Update Record action. Include a form for creating new leads directly from Retool.

Retool Prompt

Build a lead management panel with a searchable Table of Salesforce leads filtered by status and owner, a detail sidebar showing full lead record when a row is selected, a bulk status update button that updates all selected leads to a chosen status, and a Create Lead form with fields for first name, last name, company, email, phone, and lead source.

Copy this prompt to try it in Retool

Build an account health dashboard combining Salesforce and internal data

Create a unified account dashboard that joins Salesforce Account records with your internal database's usage and billing data using a JavaScript transformer. Display a Table of accounts with Salesforce data (industry, ARR, health score) alongside internal metrics (active users, last login, subscription tier), and surface at-risk accounts based on combined scoring logic.

Retool Prompt

Build an account health dashboard that queries Salesforce Accounts and joins the results with our internal PostgreSQL usage_metrics table on account.id = metrics.salesforce_account_id, showing a unified table with account name, ARR, Salesforce health score, last active user login, monthly API calls, and a calculated churn risk score. Highlight rows where churn risk is above 70.

Copy this prompt to try it in Retool

Troubleshooting

OAuth authentication fails with 'invalid_client_id' or 'redirect_uri_mismatch' error

Cause: The Connected App in Salesforce has not been approved yet (there's a 2-10 minute propagation delay after creating a Connected App), or the OAuth callback URL in the Connected App settings does not exactly match the URL Retool uses.

Solution: Wait 10 minutes after creating a new Connected App before attempting OAuth. Verify the callback URL in Salesforce Setup → App Manager → Your App → Manage → Edit → Callback URL matches exactly what Retool shows in the resource configuration panel. For Retool Cloud, the callback URL is https://oauth.retool.com/oauth/user/oauthcallback. For self-hosted Retool, it's https://your-retool-domain.com/oauth/user/oauthcallback.

SOQL query returns 'MALFORMED_QUERY: unexpected token' error

Cause: SOQL has stricter syntax requirements than SQL. Common issues include using SELECT *, querying fields that don't exist on the object, using SQL-style string quoting instead of SOQL's single-quote syntax, or referencing relationship fields incorrectly.

Solution: Verify all field names against the Salesforce Object Manager (Setup → Object Manager → select your object → Fields & Relationships). SOQL requires explicit field lists — no wildcards. Date literals must use SOQL format (e.g., 2024-01-01 not '2024-01-01'). Relationship traversal uses dot notation: Account.Name not account_name. Test your SOQL in Salesforce's Developer Console (Setup → Developer Console → Query Editor) before pasting into Retool.

typescript
1-- Correct SOQL syntax
2SELECT Id, Name, StageName, Amount, CloseDate, Account.Name, Owner.Name
3FROM Opportunity
4WHERE CloseDate = THIS_YEAR
5 AND Amount > 10000
6ORDER BY CloseDate DESC
7LIMIT 100
8
9-- Incorrect: don't use SQL-style date strings
10-- WHERE CloseDate > '2024-01-01' <- wrong
11-- Use SOQL date literals instead:
12-- WHERE CloseDate > 2024-01-01 <- correct

Query returns empty records array even though data exists in Salesforce

Cause: The authenticated Salesforce user does not have visibility to the records due to Salesforce's sharing model (org-wide defaults, sharing rules, or record ownership). Salesforce silently returns 0 records rather than throwing a permission error.

Solution: Check the Salesforce user account associated with the OAuth token. In Salesforce Setup, verify the user's Profile, Permission Sets, and the org's Sharing Settings for the queried object. For system-level read access across all records, consider using a Salesforce integration user with View All permission on relevant objects, shared via 'Share OAuth credentials between users' in the Retool resource settings. Alternatively, add WITH SECURITY_ENFORCED to your SOQL to surface permission errors explicitly rather than returning empty results.

'REQUEST_LIMIT_EXCEEDED: TotalRequests Limit exceeded' error during bulk operations

Cause: Your Salesforce org has hit its daily API call limit. Each Retool query counts as one or more API calls. With frequent Retool usage or automated Workflows querying Salesforce on a schedule, the limit can be reached, particularly on lower-tier Salesforce editions.

Solution: Switch high-volume SOQL queries to use Retool's Bulk API action type, which uses a separate Bulk API limit rather than the standard REST API limit. Implement query caching in Retool (set cache duration in the query's Advanced settings) for data that doesn't change frequently. In Salesforce Setup → Company Settings → API Usage, monitor your consumption and upgrade your edition or purchase additional API calls if needed.

Best practices

  • Create a dedicated Salesforce integration user with the minimum required profile permissions rather than authenticating as a personal admin account — this ensures audit trail clarity and avoids disruption if an admin's credentials change.
  • Use Retool configuration variables for any Salesforce instance URLs or API version numbers so you can update them centrally without modifying individual queries across your apps.
  • Implement SOQL query limits explicitly (LIMIT clause) and use pagination controls in Table components to avoid pulling thousands of records at once and hitting Salesforce API governor limits.
  • Store your most common SOQL queries as named queries in Retool and reuse them across multiple apps by sharing the resource — this prevents duplication and makes it easier to update field lists when Salesforce schema changes.
  • Always use Retool's GUI mode for Update and Delete record operations in production rather than raw SOQL DML, as GUI mode generates safer parameterized requests and Retool can validate field names at configuration time.
  • Set up separate Retool Salesforce resources for production and sandbox environments, and use Retool's resource environments feature to switch between them based on your app's deployment environment setting.
  • For queries fetching related object data (Account.Name, Owner.Name), prefer SOQL relationship queries over making separate API calls per record — this is dramatically more efficient and avoids hitting API limits.

Alternatives

Frequently asked questions

Does Retool support both Salesforce Production and Sandbox environments?

Yes. When configuring your Salesforce resource in Retool, there is a 'Use Salesforce Sandbox' toggle in the Advanced settings. Enabling this routes authentication through test.salesforce.com instead of login.salesforce.com. Best practice is to create two separate Retool resources — 'Salesforce Production' and 'Salesforce Sandbox' — and use Retool's environment settings to ensure your development and staging Retool apps use the sandbox resource while production apps use the live resource.

Can Retool query custom Salesforce objects?

Yes. Custom objects in Salesforce end with __c in their API name (e.g., Invoice__c, Project__c). Use these API names directly in your SOQL FROM clause. Custom fields on standard objects also end with __c (e.g., Account.Contract_Value__c). You can discover all custom objects and their field API names via Salesforce Setup → Object Manager.

Does Retool's Salesforce integration support the Bulk API for large data operations?

Yes. In the Salesforce query editor, switch the Action Type to 'Bulk Query' for SOQL queries returning large result sets (more than 2,000 records), or 'Bulk Update' for high-volume record updates. Bulk operations use Salesforce's separate Bulk API governor limit (10,000 batches per day vs. the standard REST API limit), making them suitable for mass data operations that would otherwise exhaust your API calls.

Can multiple Retool users share a single Salesforce authenticated session?

Yes, but this requires deliberate configuration. By default, each Retool user must individually authorize via OAuth, creating per-user Salesforce sessions. To share a single Salesforce user session across all Retool users, open the Salesforce resource settings and enable 'Share OAuth 2.0 credentials between users.' Note that all Retool users will appear in Salesforce audit logs as the shared service account user, which may impact your compliance requirements.

How do I handle Salesforce API rate limits in Retool?

Salesforce's standard API limits depend on your edition (Enterprise: 1,000 API calls per Salesforce user per 24 hours). To reduce consumption: enable query caching in Retool for read-heavy dashboards (set a cache duration in the query's Advanced tab), use the Bulk API for large data operations, and avoid setting queries to run on a very frequent automatic refresh timer. Monitor your API usage in Salesforce Setup → Company Settings → API Usage and Limits.

Can Retool write data back to Salesforce, or is it read-only?

Retool supports full CRUD operations against Salesforce. In the Salesforce query editor, switch to Action mode to access Create Record, Update Record, Delete Record, and Upsert Record operations. You can also call custom Apex REST endpoints for complex business logic. The only Salesforce features not accessible via Retool are the Salesforce UI-specific flows and approval processes, which must be triggered from within Salesforce itself.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Integrations are where projects stall

We wire Retool integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.