Available in: Axsy Mobile for Salesforce, Axsy Field Service, Axsy Public Sector, Axsy Retail Execution

The Query Details tab of a Record Set is where you can refine what records for a given object are synced to the Axsy Mobile App. This is done by either creating a set of SOQL-based queries and filters, or by selecting a List View for the object that is already defined on the Salesforce Platform.

Query Chains and Queries

A Record Set must have at least one Query Chain associated with it and that Query Chain must contain at least one Query. Together, they determine the filtered set of records that should be synced for that Record Set's object.

When a new Record Set is created, a basic Query Chain with a single Query is created by default, but you can create multiple Query Chains for a Record Set with each containing multiple Queries that feed into each other.

A single Query and the last Query in a Query Chain must return the Record Set's root object.

Example: The default Record Set for the Visit object includes two Query Chains: one for retrieving the Visits in the user's upcoming schedule and one for retrieving any previous historic Visits. The Query Chain for previous Visits contains two Queries within it: the first query retrieves a list of applicable Retail Store and the second query retrieves the previous Visits for those Retail Stores.

Filter Query Type

One method for controlling what records are synced is by directly defining the query filters to use and how they should be combined. This allows for complex querying logic using SOQL. To use this method of filtering, select the Filter option as the Query Type.

Filter Conditions

One or more conditions can be added to a Query using the Add Condition button. This will initially create a blank condition statement. Selecting a blank statement - or an already existing statement that is to be modified - will prompt the user to specify the Field, Operator and Value for the condition. Selecting Done will save the condition in SOQL-style formatting with Salesforce API names in-use.

Filter Logic

If more than one condition is specified, then the logic on how these conditions should be combined needs to be defined. In the Filter Logic field, create a query using the logical operators AND and OR and the numeric values for the available conditions.

NOTE: All conditions need to be included in the Filter Logic field, otherwise an error will appear preventing you from saving your changes.

NOTE: The conditions and their filter logic effectively define the WHERE clause part of a SOQL query.

Order, Scope and Limits

The query can be further refined using the following fields:

  • Order By Clauses: Add an ORDER BY clause which will order the records that are returned by the query based on one or more fields
  • Record Scope: Add a USING SCOPE clause which will limit the scope of records returned by the query, e.g. returning only those records owned by the user.
  • Limit: Add a LIMIT clause specifying the maximum number of records to return

NOTE: If you add multiple Order By clauses, the results will be ordered based on their sequence.

List View Query Type

The second method for  controlling what records are synced is by using an existing List View defined on the Salesforce Platform. To use this method of filtering, select the List Views option as the Query Type. This will present a list of available List Views for the applicable object from which a single List View can be selected.

Ordering Multiple Queries

A Query Chain can contain one or more Queries that can be ordered in a way to create complex data queries. The order that is defined determines the order that the app processes the queries, and so the output of one query can be used as input for another. 

To reorder a list of multiple Queries, select Reorder and then use the arrows to make changes to the order of the Queries in the Query Chain.

When multiple Queries are in in use for a Query Chain, additional parameters can be edited:

  • Object Type: The object that is targeted by the current query and which feeds into any subsequent queries.
  • Field to Return: The field of the above object which feeds into any subsequent queries.
  • Sync Individually: If enabled, the last query in the chain will execute for each record returned by the query previous to it in the chain. When enabled, always set a Limit for the last query in the chain to prevent querying too many records.