Setting up a Salesforce on Retool cloud
Cloud-only
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.
- 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, clickNew Connected App
. - In Salesforce Classic, from
Setup
, enterApps
in the Quick Find box, then selectApps
(underBuild
->Create
). UnderConnected Apps
, clickNew
.
- In Lightning Experience, use the App Manager to create connected apps. Type
- Enter the name + contact info. Try
Retool
, and your own email! - Tick
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 .salesforce.com
For example, if your instance URL ends in
.lightning.force.com
, try using.my.salesforce.com
instead.
- 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 needaccess and manage your data
andperform 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
- Click Save. The
Consumer Key
(aka. the client id) and Secret (aka. the client secret) are created.
Add the app to Retool
- Create a new resource, and select
Salesforce
. - Add the key + secret + instance URL (your Salesforce URL), and then press "Test Connection" to ensure the connection works.
- 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


Troubleshooting
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
. IfIP Relaxation
is set toEnforce IP Restrictions
, you may want change this by pressingEdit Policy
toRefresh 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 theTimeout value
is not too low.
Updated 2 months ago