Microsoft Dynamics CRM - Query record

The Microsoft Dynamics CRM - Query record action A tool for building the processes, logic, and direction within workflows. queries records of a specified entity in Microsoft Dynamics CRM, while limiting results by using conditional statements and sorting results as configured.

For example, in the Contact entity, you want to know the number of customers in a certain region. By using conditions, you can specify your query results such as: When Address 1: Country/ Region equals Singapore. You can then store the number of records returned in a variable.

For more information about Microsoft Dynamics CRM, go to Microsoft Dynamics CRM.

Configure the Microsoft Dynamics CRM - Query record action

  1. Add the action to the workflow and open the action configuration panel. For more information, see Add, rename, and copy actions.

  1. Select a Connection. If you do not have a connection, see Add a connection.
  2. Select the Entity name of the records you want to query.

  3. Limit the returned query results (add one or more conditions):

    1. Click Add condition.
    2. In the Condition section, complete the fields below.

      Field

      Description

      When Attribute from the selected object. Accepts a selection from the drop-down list.
      Operator Comparison between When and Value. Accepts a selection from the drop-down list. Selections in the drop-down list correspond to the data type of the entry for When.
      Value The value you are looking for in the attribute specified for When. Accepts either a selection from the drop-down list or an inserted variable. Accepted variable types correspond to the data type of the entry for When.
    3. Click Add condition to save your changes.
    4. To add another condition, click Add condition again.
    5. To configure query behavior for multiple conditions, select all or any.
  4. Sort returned query results:

    • For Sort by, select a value.
    • Select a Direction.

Configure the storage of Microsoft Dynamics CRM - Query record outputs

After entering values for the required fields in Microsoft Dynamics CRM - Query record action, you have the option to store the following outputs as variables:

  • Record IDs
  • Number of records returned
  1. Add the action to the workflow and open the action configuration panel. For more information, see Add, rename, and copy actions.

  1. Select a Connection. If you do not have a connection, see Add a connection.
  2. Complete the required fields, as specified in Microsoft Dynamics CRM - Query record.
  3. In Store record IDs, select a variable that will store the value of the Record IDs.
  4. In Number of records returned, select a variable that will store the value on how many records will be returned from the query.

Microsoft Dynamics CRM - Query record action fields, buttons, and settings

Section

Field

Description

Variable types

 

Connection Credentials and other settings required to pass data between the workflow and the indicated service, which could be a cloud service, business application, or content store.

The Microsoft Dynamics CRM connection to use for accessing the records to query.

(n/a)

 

Entity name

The entity of the records you want to query. Accepts a selection from the drop-down list. Options in the drop-down list are derived from the selected Microsoft Dynamics CRM connection.

(n/a)

Condition

 

Conditional statements to use for the query. For example, to query for stale items, you might configure a condition "Modified is before <yourDateVariable>."

  • To configure query behavior for multiple conditions, select all or any.
  • To add a condition, click Add condition and then fill in the fields below.
  • To edit a condition, click (Edit condition).
  • To remove a condition, click (Delete condition).

(varies)

Sorting

Sort by

Attribute to use for sorting. Accepts a selection from the drop-down list. Options in the drop-down list are derived from the selected Microsoft Dynamics CRM connection.

(n/a)

 

Direction

Option to sort in Ascending or Descending direction.

(n/a)

 

Store record IDs

Variable to store IDs of records in the returned query results.

Collection

 

Number of records returned

Variable to store the quantity of records returned by the query.

Integer