Salesforce Integration

Query Salesforce via Retool.

Setting up a Salesforce on Retool cloud



For on-premise deployments, follow the steps described here to create a Salesforce connected app.

To connect your resource to Salesforce, select whether you are connecting to a sandbox organization (Connect to a sandbox organization) and press Connect Salesforce. Follow the Salesforce authorization steps and press Allow (see below).

That's it! You can now query the Salesforce API.

Setting up a Salesforce resource with a custom connected app


Only necessary for on-premise deployments

If using Retool cloud, follow the steps described above.

Prerequisite: Create an app in Salesforce

First, you have to register Retool as a "Connected Application" under Salesforce.

  1. Create a new connected app:
    • In Lightning Experience, use the App Manager to create connected apps. Type App Manager in the quick search box. Then, click New Connected App.
    • In Salesforce Classic, from Setup, enter Apps in the Quick Find box, then select Apps (under Build -> Create). Under Connected Apps, click New.
  2. Enter the name + contact info. Try Retool, and your own email!
  3. Select Enable OAuth Settings, and enter the callback URL that Retool gives you from the resource screen:

The OAuth Callback URL to use with Salesforce.


Salesforce instance URLs must end in

If your instance URL ends in, you need to update it to use . For example:


  1. Add all supported OAuth scopes to Selected OAuth Scopes. These scopes refer to permissions given by the user running the connected app. If you add Full access we also need access and manage your data and perform requests on your behalf (a bit confusing - full access does not actually grant everything).

An example of how to configure Salesforce for use with cloud hosted Retool

  1. Click Save. The Consumer Key (aka. the client id) and Secret (aka. the client secret) are created.

Add the app to Retool

  1. Create a new resource, and select Salesforce.
  2. Add the key + secret + instance URL (your Salesforce URL), and then press "Test Connection" to ensure the connection works.
  3. Hit save!

Querying the Salesforce API

After setting up a Salesforce integration with Retool, a new option for a Salesforce query will appear on the Retool page editors. After selecting that option, you will be presented with a UI that allows you to use the Salesforce Object Query Language (SOQL) to retrieve data from Salesforce.

Bulk Operations in Salesforce

Retool supports Bulk Inserts, Bulk Updates, Bulk Upserts, and Bulk Delete from Salesforce. Here are examples of these!

Bulk Inserts

Bulk Update


If you are unable to run any Salesforce queries due to an expired access/refresh token error, it's likely that you need to change a setting within Salesforce to allow Retool to generate a valid access and refresh token. Here are a few items to check when troubleshooting:

  • In Lightning Experience, go to Setup -> Apps -> Connected Apps -> Manage Connected Apps. If IP Relaxation is set to Enforce IP Restrictions, you may want change this by pressing Edit Policy to Refresh token is valid until revoked (see screenshot below).

  • In your Retool Salesforce resource, make sure you select Connect to a sandbox organization if and only if you are connecting to a developer sandbox organization.
  • In Lightning Experience, go to Setup -> Security -> Session Settings. Make sure your organization-wide session settings are set as desired, e.g. ensure the Timeout value is not too low.