- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 12:37 PM
Hi
I am trying to write a condition argument for a scheduled job. The issue I am having is that it is ignoring the lines about instance.state. Is there really no possibility to use the instance field (of document type) for a addQuery condition? I mean we do have the table in another field so the information is there.
var ga = new GlideAggregate('sys_email');
ga.addAggregate('COUNT');
var qc1 = ga.addQuery('u_anonymisation_date','>','javascript:gs.endOfToday()');
qc1.addOrCondition('u_anonymisation_date',"");
var qc2 = ga.addQuery('instance.state','rejected'); //not working
qc2.addOrCondition('instance.state','closed'); //not working
qc2.addOrCondition('instance.state','cancelled'); //not working
var qc3 = ga.addQuery('sys_id','a90768c84f7c5700eba9fcb28110c7af');
ga.query();
ga.next();
ga.getAggregate('COUNT') !== '0';
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 01:07 PM
It's always been my understanding that you can't dot-walk document ID's, only reference fields. You would have to pass the documentID value into a different gliderecord query on the incident table to find the state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 01:07 PM
It's always been my understanding that you can't dot-walk document ID's, only reference fields. You would have to pass the documentID value into a different gliderecord query on the incident table to find the state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2018 11:20 PM
Even though I think this is strange as the info is there and ServiceNow obviously is using the field as a relation to the object it is pointing to I guess I have to accept that this "bug" is there in the setup.
So then I will try with another approach. Add a business rule on task that will mark emails related to the task as "task closed" on the email and then use that field instead.