build_query
Construct a ServiceNow encoded query string from a JSON array of conditions to filter records.
Instructions
Build a ServiceNow encoded query string from a JSON array of conditions.
Each condition is an object with:
operator: The query operator (see groups below).
field: The field name (not required for
new_query).value: The comparison value (type depends on operator).
Operator groups:
Comparison: equals, not_equals, greater_than, greater_or_equal,
less_than, less_or_equal
String: contains, starts_with, like, ends_with, not_like,
does_not_contain
Null / special: is_empty, is_not_empty, anything, empty_string
Time: hours_ago, minutes_ago, days_ago, older_than_days
Date: on, not_on, relative_gt, relative_lt, more_than
Date part: datepart (requires part, dp_operator, dp_value)
Range: between (requires start, end)
Field comparison: gt_field, lt_field, gt_or_equals_field,
lt_or_equals_field, same_as, not_same_as (use other_field for
the second field name)
Reference: dynamic, in_hierarchy
Change detection: val_changes, changes_from, changes_to
Logical: new_query (no field needed - inserts ^NQ separator)
Related list: rl_query (requires related_table, related_field,
rl_operator, value)
List: in_list, not_in_list (value is a list of strings)
OR: or_equals, or_starts_with
Ordering: order_by (optional descending: boolean)
Args: conditions: JSON array of condition objects.
Returns the encoded query string in data.query. Pass this string
as the query parameter to the query tool.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conditions | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |