0.9.6.1 – Query – Get a Single Value

This documentation is for versions 0.9.6.1 and older. Please return to the home page for the latest documentation.

Incredibly powerful tool to let you query CRM and get back the result as a typed value (ex: query for a number and you get back a number value, money returns money, etc). If you use this with FetchXml for data aggregations and workflow logic, it’s the best workflow activity you’ll ever use.

The query can either bring back a value across CRM (ex: sum of all orders totals), or you can limit it to records related to whatever the workflow is running on (check out this post for more details).

Usage Examples:

  • Get the total amount of orders from a customer in the past year, and if it’s more than $10,000 then send an email using a different template (the big spender template).
  • Get the largest open opportunity for a contact.

Input Parameters

Parameter Name Type Description Default
Pick a System View to Use Saved Query record A CRM view which was created as a system view. These are typically included with CRM out of the box or in other solutions. The returned value will be the first result, first column based on the query. {null}
or pick a Personal View to Use User Query record A CRM view which was created as a personal view. The returned value will be the first result, first column based on the query. {null}
or enter FetchXML to Use Text A CRM query represented by FetchXML. If you copy and paste it from CRM, make sure to remove all the line breaks before you paste it in or CRM may cut off the text and the query won’t be valid. The returned value will be the first result, first column based on the query. You can use aggregations and other valid FetchXml functions such as Min and Max. {null}

Output Parameters

Parameter Name Type Description
Did the query return a value? Boolean Indicates if a value was returned from the query.
Query Result as Whole Number Whole Number If the query results can be parsed as an integer, this field will be set to the integer value.
Query Result as DateTime DateTime If the query results can be parsed as a Date Time, this field will be set to the date time value.
Query Result as Decimal Decimal If the query results can be parsed as a decimal, this field will be set to the value cast as a decimal.
Query Result as Double Double If the query results can be parsed as a double, this field will be set to the value cast as a double.
Query Result as Money Money If the query results can be parsed as a decimal, then a Money field (according the SDK rules), this field will be set to the Money value.
Query Result as ID Text If the query results can be parsed as a valid Guid, this field will be set to the ID.
Query Result as Text Text Set to the display value of the result.