|
8 | 8 | Basic allows you to look for exact matches as well as fields that are like a value; these are all and'd together. |
9 | 9 | You can also sort your results, ascending or descending, by 1 field. |
10 | 10 |
|
11 | | - Advanced allows you to perform the complete set of operations that ServiceNow has (mostly). |
| 11 | + Advanced allows you to perform the (almost) complete set of operations that ServiceNow has. |
12 | 12 | The comparison operators have been made to mimic powershell itself so the code should be easy to understand. |
13 | 13 | You can use a very large set of comparison operators (see the script variable ServiceNowOperator), |
14 | 14 | and, or, and grouping joins, as well as multiple sorting parameters. |
15 | 15 |
|
16 | 16 | .PARAMETER Filter |
17 | 17 | Array or multidimensional array of fields and values to filter on. |
18 | 18 | Each array should be of the format @(field, comparison operator, value) separated by a join, either 'and', 'or', or 'group. |
19 | | - For a complete list of comparison operators, see $script:ServiceNowOperator. |
| 19 | + For a complete list of comparison operators, see $script:ServiceNowOperator and use Name in your filter. |
20 | 20 | See the examples. |
| 21 | + Also, see https://docs.servicenow.com/bundle/quebec-platform-user-interface/page/use/common-ui-elements/reference/r_OpAvailableFiltersQueries.html |
| 22 | + for how to represent dates. |
21 | 23 |
|
22 | 24 | .PARAMETER Sort |
23 | 25 | Array or multidimensional array of fields to sort on. |
|
49 | 51 | New-ServiceNowQuery -Filter @('state', '-eq', '1') -Sort @('opened_at', 'desc'), @('state') |
50 | 52 | Get query string where state equals New and first sort by the field opened_at descending and then sort by the field state ascending |
51 | 53 |
|
| 54 | +.EXAMPLE |
| 55 | + New-ServiceNowQuery -Filter @('opened_at', '-ge', 'javascript:gs.daysAgoEnd(30)') |
| 56 | + Get query string where the record was opened in the last 30 days |
| 57 | +
|
52 | 58 | .INPUTS |
53 | 59 | None |
54 | 60 |
|
|
0 commit comments