How to GET records from Salesforce using Logic App
Part 2: How to get records from Salesforce in Logic App – Using SOQL
Introduction:
Working with Salesforce connectors can be a bit tricky as you have to convert your SOQL into a set of built-in parameters provided by the Salesforce GET records connector. This blog will show you how you can easily handle this in two parts as follows:
Part 1: How to GET records from Salesforce using Logic App Salesforce GET Records Connector
Part 2: How to GET records from Salesforce using Salesforce SOQL in Logic App
How to GET Records using SOQL in Logic App HTTP connector
Following a sample sequence of steps that can be used fetch the Accounts from salesforce and further its related records. This example also shows how you can use the different parameters provided by this built in GET Records connector.
Step 1: Add an Azure Function block to get salesforce access token. Here in backend the selected function sends the access token to authenticate with Salesforce on execution of this block.
Step 2: Add an HTTP block and configure it as follows to run SOQL query. The URI is composed as follows https://test.my.salesforce.com/services/data/v49.0/query?q={{SOQL_Query}}. Here the SOQL which we append at the end of the URL must be in encoded format. You can use the https://meyerweb.com/eric/tools/dencoder/ online editor for this purpose where you can encode your SOQL and attach it at end of URL.
In Headers add Authorization : Bearer {{Access_Token}}
Conclusion:
Here we have learned how to use the Logic App HTTP connector to retrieve the records from Salesforce using the SOQL.
Part 1: How to get records from Salesforce in Logic App – Using built in Salesforce GET Records Connector
Part 2: How to get records from Salesforce in Logic App – Using SOQL