Skip to end of metadata
Go to start of metadata

Introduction

A Salesforce Query activity queries data from a Salesforce endpoint and is intended to be used as a source to provide data to an operation. After configuring a Salesforce connection, you can configure as many Salesforce activities as you like for each Salesforce connection.

Creating a Salesforce Activity

From the design canvas, open the Connectivity tab of the design component palette:

Use the Show dropdown to filter on Endpoints, and then click the Salesforce connection block to display activities that are available to be used with a Salesforce connection:

To create an activity that can be configured, drag the activity block from the palette to the operation.

For more information about the parts of an operation and adding activities to operations, see Operation Creation and Configuration.

Configuring a Salesforce Query Activity

Follow these steps to configure a Salesforce Query activity:

Step 1: Enter a Name and Select Objects

In this step, you provide a name for the activity and select the object(s) to be queried.

  • Name: Enter a name to use to identify the Salesforce Query activity. The name must be unique for each Salesforce Query activity and must not contain forward slashes (/) or colons (:).
  • Select Object(s): This section displays objects available in the Salesforce endpoint:
    • View: Use the dropdown to filter the list of objects to all objects, standard objects, or custom objects. By default, all objects are shown.

    • Search: Enter any part of the object name into the search box to filter the list of objects. The search is not case-sensitive.

    • Refresh: Click the refresh icon  to reload objects and fields from the Salesforce endpoint. This may be useful if you have recently added objects or fields to Salesforce.
    • Select Object(s): The list of objects is displayed in a column on the left. Click the object to add it to the list on the right. Only one primary object can be selected from the list on the left.

      TIP: If the list does not populate with available objects, the Salesforce connection may not be successful. Ensure you are connected by reopening the connection and retesting the credentials.
  • Select Related Object(s): Optionally, to include child or parent objects in the query, select the checkbox next to each related object to include. This is referred to as a relationship query.

    NOTE: Selection of related objects is limited to immediate children and ancestors up to 5 levels. This includes parent(s) of a child, but does not include a child of a child or another child of a parent.
    • Refresh: Click the refresh icon  to reload objects and fields from the Salesforce endpoint. Existing selections in Select Related Object(s) remain only if those objects are used in step 2. Any objects that are not used in step 2 have their selection cleared.

  • Preview Fields: To preview fields for a specific object, click directly on the object name under Select Related Object(s). Note that enabling the field preview is independent of which field checkboxes are selected. That is, you can preview fields for objects regardless of whether they are selected.

  • Save & Exit: If enabled, click to save the configuration for this step and close the activity configuration.
  • Next: Click to temporarily store the configuration for this step and continue to the next step. The configuration will not be saved until you click the Finished button on the last step.
  • Discard Changes: After making changes, click to close the configuration without saving changes made to any step. A message asks you to confirm that you want to discard changes.

Step 2: Select Fields and Create Conditions

In this step, you create the query statement, either automatically by selecting fields and specifying conditions, or manually by directly entering a query statement. You must test the query to ensure it is valid before you proceed to the next step.

TIP: Fields with a variable icon support using global variablesproject variables, and Jitterbit variables. Begin either by typing an open square bracket [ into the field or by clicking the variable icon to display a list of the existing variables to choose from.

  • Select Fields & Create Conditions: This section displays fields for the selected object(s) that are available in the Salesforce endpoint. Objects that were selected in the previous step are shown in bold.
    • Search: Enter any part of the field name into the search box to filter the list of fields. The search is not case-sensitive. The listed results are filtered in real time with each keystroke.
    • Select All: When using the search box to filter, you can use this checkbox to select all visible fields at once (objects and collapsed fields are not selected).
    • Select Fields: Select the checkboxes of the fields you want included in the query to have them automatically added to the SOQL statement on the right. Unless using the search box, you can also select an entire object to select all of its fields at once.
  • SOQL Statement: As you select fields, the query statement in the upper right text box autopopulates with the object and selected fields. To use a custom SOQL statement, make edits within this text box as necessary. For reference on how to structure a custom SOQL statement, see Salesforce's documentation on SOQL SELECT Syntax.
  • Include Deleted Rows: Select this checkbox to include rows that are marked as deleted within Salesforce. (This applies both during testing of the query as well as during runtime.)

  • Test Query: Click this button to validate whether the query is valid. If the query is valid, a sample of 10 records retrieved from the query is displayed in a table similar to that shown below. If the query is not valid, relevant error messages are displayed. The query must be valid in order to enable the Next button.

  • WHERE Clause (Optional): To add a WHERE clause, use the fields below as input to help construct the clause, or manually enter the clause in the lower text box. After adding a WHERE clause, you must first test the query using the Test Query button in order to enable the Next button.
  • Object: Field: Use the dropdown to select a field from the selected objects.
    • Operator: Use the dropdown to select the appropriate operator(s). The list of available operators depends on the data type of the selected field.

      Comparison
      =Equals
      !=Not equals
      <Less than
      <=Less than or equals
      >Greater than
      >=Greater than or equals
      LIKELike
      ININ
      NOT INNOT IN
      INCLUDESApplies only to multi-select picklists
      EXCLUDESApplies only to multi-select picklists
      Logical
      ANDTRUE if both left and right expressions are TRUE
      ORTRUE if either left or right expression is TRUE
      NOTTRUE if right expression is FALSE
    • Value: Enter the desired value to use with the dropdown selections. When the value is a string, enclose the value in single quotes to match the format used by Salesforce.

      CAUTION: When using global variables in a WHERE clause, you must specify a default value in order for the query to be valid for testing (with the Test Query button), as global variables obtain their value at runtime (see Defining a Default Value in Global Variables).
    • Add: Click the  link to automatically construct the clause based on the dropdown selections and entered value. The automatically constructed clause appears in the lower text box. 
    TIP: To add multiple conditions to the clause, repeat the process by adding additional selections. Note that you may need to add a logical operator such as AND or OR to account for the additional conditions.
  • Back: Click to temporarily store the configuration for this step and return to the previous step.
  • Next: Click to temporarily store the configuration for this step and continue to the next step. The configuration will not be saved until you click the Finished button on the last step. If you have added a WHERE clause, you must test the query using the Test Query button to enable the Next button.
  • Discard Changes: After making changes, click to close the configuration without saving changes made to any step. A message asks you to confirm that you want to discard changes.

Step 3: Review the Data Schemas

In this step, any request or response schemas generated from the endpoint are displayed:

  • Data Schema: The response data schema is displayed. If the operation uses a transformation, the data schemas are displayed again later during the transformation mapping process, where you can map to target fields using source objects, scripts, variables, custom values, and more.

    The version of Salesforce REST API that is used depends on the Harmony Agent version you are using. See Prerequisites and Supported API Versions for links to documentation on the schema fields.

    NOTE: To refresh a data schema in an existing activity, you must advance through each activity configuration step again, making at least one change (such as adding and removing a character from the end of the name of the activity) to force a refresh of the schema.
  • Back: Click to temporarily store the configuration for this step and return to the previous step.
  • Finished: Click to save the configuration for all steps and close the activity configuration.
  • Discard Changes: After making changes, click to close the configuration without saving changes made to any step. A message asks you to confirm that you want to discard changes.

Next Steps

After configuring a Salesforce Query activity, complete the configuration of the operation by adding and configuring other activities, transformations, or scripts as operation steps. You can also configure an operation's operation settings, which include the ability to chain operations together that are in the same or different workflows.

Once a Salesforce Query activity has been created, menu actions for that activity are accessible from the project pane in either the Workflows or the Components tabs, and from the design canvas. See Activity Actions Menu for details.

Salesforce Query activities can be used as a source with these operation patterns:

If a Salesforce Query is used as the source activity, then a target activity is required.

Operations that contain a Salesforce activity can have only one Salesforce activity and cannot also contain any other application activities.

A Salesforce activity can be used as an operation step in only a single operation. That is, you cannot reference the same activity multiple times within other operations. Instead, you can make a copy of a Salesforce activity to use elsewhere (see Component Reuse).

Other patterns are not valid using Salesforce Query activities. See the validation patterns on the Operation Validity page.

A typical use case is to use a Salesforce Query activity in the Transformation Pattern. In this example, the Salesforce Query activity (Query) provides data within the operation, which is then received by the transformation (Salesforce to Variable). The Variable Write activity (Write Query Response) is used as the target, receiving data within the operation and a message is then logged by the Write to Operation Log script:

Within a transformation, if using the option to mirror a schema provided by a non-bulk Salesforce activity, then the resulting mirrored schema will automatically be created with an additional root node called records with the child node(s) mirroring the schema. When fields within the child node(s) are mapped to, the node becomes a loop node to allow all records to be looped through (see Loop Nodes under Data Structures).

Operations that use Salesforce activities can also have operation actions configured to trigger on a SOAP fault — an error resulting from an incorrect message format, header processing, or incompatibility. Operation actions can be configured to run an operation or send an email after a SOAP fault occurs. For instructions on triggering an action on SOAP fault, refer to Operation Actions.

To use the activity with scripting functions, write the data to a temporary location and then use that temporary location in the scripting function.

When ready, deploy and run the operation and validate behavior by checking the operation logs.

  • No labels