- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2015 08:52 AM
My question is more specific to Request Item and children Catalog Tasks, but the logic would probably apply to any parent/child or one/many relationship.
I'd like to setup a scheduled job to auto-close any RITMs that don't have any active children Catalog Tasks, but I'm not sure how to query to find the records. We don't assign RITMs to groups in our environment, so if somehow all of the active Catalog Tasks get closed without the parent RITM getting closed, the RITM just hangs out there in an active state.
I suppose another wrench could be that a RITM could be awaiting an Approval, but have no active Catalog Task.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2015 07:39 AM
You can do the following to check if your GlideRecord object holds any records.
var inc = new GlideRecord('incident');
inc.addActiveQuery();
inc.query();
inc.HasNext(); //returns true or false depending on whether the inc object has any records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2019 11:49 PM
I had a similar question for groups. Here is how I resolved it:
https://community.servicenow.com/community?id=community_question&sys_id=86b8c361db5cdbc01dcaf3231f9619f3