- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2022 09:52 AM
Hi All,
I wanted to check if an incident record is available with either resolved state or closed state or cancelled state
is below script for querying the table right?
inc.addQuery('state=7'||'state=6'||'state=8'); // is this querying right?? as am not getting the output
Please advice
Regards,
Sandeep
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 04:34 AM
Hi,
The suggested addEncodedQuery is 1 option.
You can also do it via the addOrCondition:
var grIncident2 = new GlideRecord('incident');
grIncident2.addQuery('incident_state',6).addOrCondition('incident_state',7).addOrCondition('incident_state',8);
grIncident2.query();
gs.print("COUNT IS : " + grIncident2.getRowCount());
Or even via the addQuery with IN:
var grIncident = new GlideRecord('incident');
grIncident.addQuery('incident_stateIN6,7,8');
grIncident.query();
gs.print("COUNT IS : " + grIncident.getRowCount());
Regards,- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 04:34 AM
Hi,
The suggested addEncodedQuery is 1 option.
You can also do it via the addOrCondition:
var grIncident2 = new GlideRecord('incident');
grIncident2.addQuery('incident_state',6).addOrCondition('incident_state',7).addOrCondition('incident_state',8);
grIncident2.query();
gs.print("COUNT IS : " + grIncident2.getRowCount());
Or even via the addQuery with IN:
var grIncident = new GlideRecord('incident');
grIncident.addQuery('incident_stateIN6,7,8');
grIncident.query();
gs.print("COUNT IS : " + grIncident.getRowCount());
Regards,- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 04:38 AM
Hi,
Where are you writing this code , can you let me know and accordingly can assist you with the sample code to be used.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 10:06 AM
Hi Sholke,
Got the answer from the above replies
Thanks anyways