
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 07:36 AM
I have a flow in which I am creating a REQ/RITM/SCTASK and then trying to wait for all of the tasks on the RITM to complete. Here is the wait for condition I am trying to use:
and the script:
var tasks=new GlideRecord('sc_task');
tasks.addQuery('request_item', fd_data._2__create_record.record.sys_id);
tasks.addQuery('state','<',3);
tasks.addActiveQuery();
tasks.query();
if (tasks.next()) {
answer = false;
}
else {
answer = true;
}
For whatever reason, it falls through every time. I even tried switching answers to see if that would fix it. It falls through no matter what.
Here is the flow:
Am I missing something? Is there supposed to be another step somewhere?
Thank you,
Charles
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 10:01 AM
Hi,
I see that your "Wait for Condition" is on the Requested Item table, but you are not returning any real filter condition for that table through the script.
In your step#3, you are creating some task, is that the task associated with RITM or something else? I'm trying to see whether you can set your "Wait for Condition" on the sc_task table itself an avoid the need to script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 06:55 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 09:20 AM
HI,
tasks.addQuery('request_item', fd_data._2__create_record.record.sys_id);
Is this true?
What is _2__create_record?
Also try state=3 instead of <
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 09:36 AM
Access Flow/Action data using the fd_data object. The _2__ means step 2.
I only want it to exit the wait for when the state is completed. Therefore, I need it to be < 3.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 09:45 AM
HI,
Yes so you can try state = 3 and test.
Also check the log
gs.info('ID : '+fd_data._2__create_record.record.sys_id);
var tasks=new GlideRecord('sc_task');
tasks.addQuery('request_item', fd_data._2__create_record.record.sys_id);
tasks.addQuery('state',3);
tasks.addActiveQuery();
tasks.query();
if (tasks.next()) {
answer = false;
}
else {
answer = true;
}
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 10:01 AM
Hi,
I see that your "Wait for Condition" is on the Requested Item table, but you are not returning any real filter condition for that table through the script.
In your step#3, you are creating some task, is that the task associated with RITM or something else? I'm trying to see whether you can set your "Wait for Condition" on the sc_task table itself an avoid the need to script?