Use an Advanced Query to Get Records from Salesforce

Use the Advanced Query activity to create a Salesforce query. You can get records with multiple entities and multiple WHERE clauses. You can map the query results from Salesforce to your process schema.

To get the records using a custom, advanced query, do the procedure in this topic.

Salesforce Query Advanced Entity Configuration Screen



Prerequisites

Good to Know

How to Start

  1. On the Organizer, do one of these:
  2. Do one of these:
    • Add an activity:
      1. In the Process Builder, in the Activity Library, open the Salesforce tab.
      2. On the Salesforce tab, drag the Query Advanced Entity activity onto your process.
    • Change an activity:
      1. In your process, double-click your activity.
  3. On the SaleForce Query Entity Configuration screen, click Advanced Query Entity .

Procedure

  1. On the SaleForce Query Entity Configuration screen, in the Salesforce field, select your Salesforce access token.

    To create a new access token, click Add Token . For more information, refer to New Salesforce Access Token.

  2. Complete this field as necessary.
    Field Name Definition

    Query

    Function:
    Specifies the select statement that defines the SQL query the activity does to get records from Salesforce.
    Accepted Values:
    A valid SQL select query.
    Default Value:
    None
    Accepts Process Data Variables:
    Yes
    Example:
    SELECT Id, Name FROM Account 
      WHERE Id IN ( SELECT AccountId FROM Contact WHERE LastName LIKE 'apple%' )
      AND Id IN ( SELECT AccountId FROM Opportunity WHERE isClosed=false)
  3. Click Execute Query to display the response of the query in Result Query box.
  4. On the Schema Mapper field, click the Ellipses button.
  5. On the Schema Mapper screen, map the response columns to the schema elements.