How to query Salesforce using EasyMorph 4.6

While a dedicated Salesforce-related action and connector are already on our to-do list and planned for release in v5 later this year, you can already start querying Salesforce using existing EasyMorph tools! In this article, I will explain how to create and configure a connection to Salesforce. Also, a working sample project is attached.

Creating Connected App in Salesforce

First, you need to create a new Connected App. Note that using Web API in Salesforce requires you to have an Enterprise or Unlimited account (as of January 2021).

To create a Connected App, you should go to Platform Tools → Apps → App Manager and then pick the “New Connected App” button that’s located in the top-right corner of the app manager page.

Fill in required fields, such as “Connected app name”, “API name,” and “Contact email” — fill them as you like, then tick the “Enable OAuth settings” checkbox.

In “Callback URL” below, enter the local address that Easymorph would use to receive authorization tokens. This should be something like “http://localhost:XXXX/authorize”, where XXXX is a free port of a PC that your copy of Easymorph runs on. Pick any number you like — for example, “http://localhost:7890/authorize” should work fine — but remember to enter exactly this URI in the “Redirect URI” box during the connector configuration step. Salesforce checks this URI to match during the OAuth process.

In “Selected OAuth scopes,” pick “Access and manage your data (api)” and “Perform requests on your behalf at any time (refresh_token, offline_access)”. These scopes too have to be entered during the connector configuration step.

Generally, your OAuth settings box should look like this:

After you are done with filling in the rest of the description, click the “Save” button at the bottom of the page and wait for approximately 10 to 20 minutes for Salesforce to recognize your newly created application.

Configuring EasyMorph Web location connector

In Easymorph, go to “Connector Manager”, pick “New Connector” → “Web location”, then click “Presets” and pick “Salesforce”. That should fill all standard fields, including permission scopes and authorization/token/redirect URLs



Now you have to fill two remaining fields (Base URL in general Connection tab and Client ID in OAuth configuration window), and you’re good to go.

Click the “Configure” button next to the Authentication combobox (that should display “OAuth” now). OAuth configuration window should appear. Open the “Settings” tab and fill in the Client ID field using values from Salesforce Connected App “Consumer key” configuration field. To find it, go to your Salesforce account, Apps → App Manager, find your newly created Connected App and click the dropdown icon situated in the rightmost column, then choose the “View” option. On a page that appears, you should see your Consumer Key in the API section:

Now you have everything that is needed to complete the authentication step but to be able to run queries against Salesforce you have to enter one more value, that’s a “Base URL” in the Web Location connector “Connection” tab.

For Salesforce, this URL is a combination of your assigned instance ID and Web API URL and should look like


In this example, EU40 is an instance name and the rest is a base URL for running SOQL queries. The instance name is provided by Salesforce in a custom “instance_url” claim during the OAuth flow process and as such is not recognized by EasyMorph for now, but it can be guessed.

First, you can go to your Salesforce account, Settings → Company Settings → Company Information and there you have the “Organization detail” block and “Instance” field.

Second, you can copy the first part of the URL while you are at your Salesforce account page. Enter copied text as an instance, postfixed with ‘.my’ part, see below:

Copy first subdomain from URL (that’s your account name)


And paste it like this, appending ‘’ afterwards


Now you should be able to press the “Authorize” button in the connector window and start querying your data!

Querying Salesforce

The easiest way to execute SOQL Query is (if you have less than 2000 resulting rows) to use the “Import from Web API” action. Just add this action, select your newly created Salesforce connector and add “q” to the URL parameters block. That’s where you can enter queries in SOQL:


Apply deduplication/cleanup actions to your taste and you should be able to see your data:


However, when the expected row count for your query exceeds 2000 (default Salesforce page size), such a simple approach would not suffice, and you will need to deal with paging, which is implemented in Salesforce via server-side cursor that has to be consecutively queried using “nextRecordsUrl” response field.

Handling server-side cursors can be done by the “Iterate Web request” action and is a little out of the scope of this article, but for those who need such functionality right now, there is an example project with a ready module in the attachment:

Salesforce Query Example.morph (8.4 KB)

Note that the attached example does not include an embedded Salesforce connector, and you have to create your own and use it instead of the ‘salesforce-connector’ placeholder in the ‘Sf Query’ module

The project allows executing any SOQL (Salesforce Object Query Language) query specified as a project parameter and return the result. Even if you don’t want to get into details on how the project works, you can use it as a “black box”. Just configure a Salesforce connector, then run this project with a SOQL query from other projects in order to pull data from Salesforce.

1 Like

Hello @olysak, thanks for this guide!

In order for this to work I also have to put “” (the domain + “.my.”) instead of “login” in the Authorization URL and the Token URL.

Regarding the instance ID, what is it used for? In the last Base URL screenshot you show, the instance ID is not included (the domain + “.my.” is included).

Thanks very much,


That’s very suspicious, because Salesforce OAuth flow endpoints should not contain instance IDs in their URLs (in fact, Salesforce provides an ‘instance_url’ only after authorization succeeds), and therefore Web Location ‘Salesforce’ preset auth/token URLs should work out-of-the-box.

What error did you get with default auth/token Salesforce URLs?

You can put Instance ID or domain+".my" in base URL, they are interchangeable and both should work for now

Hello Olysak,

Now I know what was going on! I was connecting a sandbox org, so in that case the flow endpoints should be “” or include My Domain.

Regarding My Domain, it seems to always work, be it a production org, developer org or sandbox org.

In the following Salesforce help article about OAuth Flow Endpoints, at the end of the article it is stated:

All endpoints require secure HTTP (HTTPS). Instead of using, you can also use the My Domain, Experience Cloud site, or (sandbox) domains in these endpoints. For hostname, use the My Domain, Experience Cloud site, or custom URL.

I had another question regarding refresh tokens. At the beginning of January I was having problems with the “Web Location” connector because after a certain timeout (in Salesforce the maximum timeout value is 24 hours), the connected app is disconnected, the connector isn’t able to obtain a refresh token, and has to be authorized again in the Connector Manager, see this thread:

However, yesterday I saw that some connectors I authorized weeks ago were still working correctly! Has something changed in the way EasyMorph is managing the refresh tokens?

Thanks a lot,


In version 5.0 we’ve added the following:

  • Native connector to Salesforce
  • Action “Import from Salesforce”
  • Action “Export to Salesforce”
  • Action “Update/delete records in Salesforce”

Working with Salesforce is now a breeze :slight_smile:

To learn more about EasyMorph visit