Skip to content

Commit ace634b

Browse files
committed
help updates
1 parent 3ab8104 commit ace634b

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

ServiceNow/Public/New-ServiceNowQuery.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@
88
Basic allows you to look for exact matches as well as fields that are like a value; these are all and'd together.
99
You can also sort your results, ascending or descending, by 1 field.
1010
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.
1212
The comparison operators have been made to mimic powershell itself so the code should be easy to understand.
1313
You can use a very large set of comparison operators (see the script variable ServiceNowOperator),
1414
and, or, and grouping joins, as well as multiple sorting parameters.
1515
1616
.PARAMETER Filter
1717
Array or multidimensional array of fields and values to filter on.
1818
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.
2020
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.
2123
2224
.PARAMETER Sort
2325
Array or multidimensional array of fields to sort on.
@@ -49,6 +51,10 @@
4951
New-ServiceNowQuery -Filter @('state', '-eq', '1') -Sort @('opened_at', 'desc'), @('state')
5052
Get query string where state equals New and first sort by the field opened_at descending and then sort by the field state ascending
5153
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+
5258
.INPUTS
5359
None
5460

ServiceNow/config/main.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,39 +98,39 @@
9898
"RequiresValue": true
9999
},
100100
{
101-
"Name": "lt",
101+
"Name": "-lt",
102102
"QueryOperator": "<",
103-
"Description": "",
103+
"Description": "field is less than the value. can be used with dates to represent prior to the value.",
104104
"RequiresValue": true
105105
},
106106
{
107-
"Name": "le",
107+
"Name": "-le",
108108
"QueryOperator": "<=",
109-
"Description": "",
109+
"Description": "field is less than or equal to the value. can be used with dates to represent prior to or the day of the value.",
110110
"RequiresValue": true
111111
},
112112
{
113-
"Name": "gt",
113+
"Name": "-gt",
114114
"QueryOperator": ">",
115-
"Description": "",
115+
"Description": "field is greater than the value. can be used with dates to represent after the value.",
116116
"RequiresValue": true
117117
},
118118
{
119-
"Name": "ge",
119+
"Name": "-ge",
120120
"QueryOperator": ">=",
121-
"Description": "",
121+
"Description": "field is greater than or equal to the value. can be used with dates to represent after or the day of the value.",
122122
"RequiresValue": true
123123
},
124124
{
125125
"Name": ".startswith",
126126
"QueryOperator": "STARTSWITH",
127-
"Description": "",
127+
"Description": "field starts with the value",
128128
"RequiresValue": true
129129
},
130130
{
131131
"Name": ".endswith",
132132
"QueryOperator": "%",
133-
"Description": "",
133+
"Description": "field ends with the value",
134134
"RequiresValue": true
135135
}
136136
]

0 commit comments

Comments
 (0)