Submitting your Query to Salesforce.

Submitting your query to SalesForce

You are now ready to submit your query to Salesforce. Add another EXTERNAL API CALL action to the flow:

Configure the action as follows:

Add Headers

Add an Authorization Header. The value of this header should include the term Bearer as well as the Access token received in Action #4. (Bearer $EXTCALL_4.access_token)

Basic Auth

  • UserName: Leave Blank. The access token takes care of this for you
  • Password: Leave Blank. The access token takes care of this for you
  • Method: Set this to POST
  • Timeout: The default is 10 seconds. This should be fine for your instance.
  • URL Of Service: Set this to the URL of your Salesforce instance.  https://<Your Instance Name>.my.salesforce.com/services/data/v39.0/parameterizedSearch/
  • Body  For this query, we decided on using a parameterized search query. The following will provide you the Name, ID, Account ID and Mobile Phone Number of the contact

Parameters:

q: The string you wish to search for. We set this to the variable with our country code stripped out: $phoneNumber fields: The fields you wish to have returned. We chose to return the ID for the contact, their Account ID, their full name, Phone Number, and Mobile Phone Number. Please check with your Salesforce Administrator for a complete list of available fields. sobjects: The salesforce object you wish to search. We choose the CONTACTS object for this query For more information on Parameterized Queries and how to use them please visit the following Salesforce documentation: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_search_parameterized.htm Results will be returned in the following format: To access these values, you will need to set your response variable to capture the data you desire. For our example we want the following name /value pairs:
Variable Maps To
Name searchRecords[0].Name
Id searchRecords[0].Id
AccountId searchRecords[0].AccountId
MobileNumber searchRecords[0].MobilePhone
Phone searchRecords[0].Phone
Email searchRecords[0].Email

Continue building your Flow

Your flow will now return the values within system variables. Their names will take the following format: $<Object Name>.<Variable Name> (eg. $EXTCALL_5.Name, $EXTCALL_5.Id). You can now reference this during the remainder of your flow.