Submitting Your Query to Salesforce

Overview

Once you are ready to submit your query to Salesforce, add an EXTERNAL API CALL action to your SmartFlow.

Configure the Action

Headers

Add an Authorization Header. The value of thes 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://.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, check out the Salesforce Parameterized Search documentation.

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

Building Your Flow

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