Loading
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Query Salesforce Data from an Omniscipt with the Lookup Element

          Query Salesforce Data from an Omniscipt with the Lookup Element

          Run a query using text input to retrieve Salesforce data using the Lookup element. The retrieved data is returned in value-label pairs and becomes available for selection in a dropdown list.

          The Lookup element calls the Omnistudio Data Mapper Extract service to query sObject tables based on the parameters configured in the Properties section. To avoid performance issues, keeping the number of value results under 150 is recommended. To use a custom Apex class to perform the lookup, select the Custom type. Lookup elements display values from Salesforce based on a standard SOQL query built using the parameters of the Lookup elements.

          SObject Type

          To query for SObject data:

          1. Set the Data Source Type to SObject.
          2. Under Input Parameters, configure these fields:
            • Data Source: Select an Element Name from the dropdown to send that element's JSON value in the lookup request. For example, suppose the Data Source is a Text input element named CompanyName that asks the user for the name of an Account.
            • Filter Value: Enter a name for the JSON value to use in the lookup query. You can use any value as long as it matches a Filter Value in a Lookup Query Configuration.
          3. Configure the Lookup Query Configuration:
            1. Click Add New Lookup Query Configuration.
            2. Enter a number to set priority for the Lookup order if there are multiple queries.
            3. Select a Lookup SObject.
              For example, Account.
            4. Select a Lookup SObject Field field to run the query on.
              For example, Name.
            5. Click Filter Operator to select an operator.
              For example, to return an exact match, use the = operator, or to select matches similar to the filter value, select the LIKE operator.
            6. Enter the name of a Filter Value used in the Input Parameters section.
              For example, Company Name.
            7. Set the return path for the filtered values by adding the element name of the Lookup element in the JSON path.
              For example, Company.
          4. In the Populate Lookup Element with Query Results section, set a label and a value for the Lookup results by configuring these fields:
            • Label: Set the label for a Lookup Element's dropdown list to a JSON Value returned by the query. Because the query returns the values in the Lookup Element's JSON Path, you must set the full path. For example, to display an Account Name as a label in a Lookup Element named Company, the full path is Company:Name.
            • Value: Set the Value to an Object field that populates the Lookup Element's JSON Node using the full path. When a user selects a label, the value populates the Lookup element's JSON Node. For example, to use an Account Id for a JSON value when a user selects an Account Name from the Lookup element, the full path is Company:Id.
          5. Preview the Omniscript to ensure the query is working and the value is being set correctly.
            The query is structured in this format:
            SELECT Lookup Object WHERE Lookup Object.Field Name = Filter Value

          Custom Type

          Use the Custom type to call a custom Apex class.

          The Apex class implements Callable or namespace.VlocityOpenInterface, where namespace is the namespace of the package. The source is namespace.ClassName.MethodName.

          For more details on query configurations, see Working with Working with Lookup Query Configurations.

          Picklist Filter by Record Type

          Enable the filtering of picklist options by record type.

          You can look up picklist fields and record types for an object in Setup in the Object Manager.

          1. In the Picklist Object and Field property, enter the picklist in this format: ObjectAPIName.FieldAPIName.
          2. Filter the picklist by Record Type.

          Working with Lookup Query Configurations

          When using the Lookup Element in Omniscript, the filtering of results is performed by the Lookup Query Configuration properties section. There are three main types of queries that can be built using this the Lookup Query Configuration properties section: AND join, OR join, and Deep query.

          AND Join

          To create AND Join and filter results on two or more fields set the sequence field value to the same value as the fields you want to join together in the query.

          Example AND Join

          image

          In this example, we search for Leads that have Country = "USA" AND City = "San Francisco". This is done by selecting the same Lookup order and populating the JSON Path with the same value.

          Note
          Note

          The JSON path can be any text but a best practice is to name the JSON Path the object being referenced.

          Deep Query

          To create a Deep query, the Lookup Order is put in sequential order. Omniscript builds smaller query sets at each order set.

          Example Deep Query

          image

          In the example Deep query we are search for Leads that have Country = "USA" AND City = "San Francisco".

          The from that data set we also only display Leads that have Industry = "Government". Since we are performing a Deep Query the JSON Path Field Name needs to be updated to populate Accordingly.

          Note
          Note

          The JSON path in the Field Population property section must match the text used in the JSON Path. A best practice is to separate the JSON Path with a colon to indicate the nested JSON Path.

          OR Join

          OR Joins are not currently supported from within the Omniscript editor so a workaround must be used to accomplish this functionality. To perform an OR Join, a custom formula field on the object can be implemented to accomplish the OR portion of the query such that the formula will return either a TRUE value if the OR query is met and FALSE if not.

          Example with an OR Join

          image
          
          The Vlocity_Industry__c formula field example uses this syntax:
          IF(
          OR(
          ISPICKVAL(Industry, "Government"),
          ISPICKVAL(Industry, "Insurance"),
          ISPICKVAL(Industry, "Communications")
          
          ),
          
          "TRUE",
          
          "FALSE")

          This effectively allows for an OR join even though the Omniscript element doesn't support this functionality directly.

          Note
          Note

          In all instances, Filter Values must be text and wrapped in double quotations.

           
          Loading
          Salesforce Help | Article