Wait for condition Script in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2018 07:47 AM
Hi all,
I have wait for condition and it should work when the status is 'closed complete' or 'closed incomplete' or 'closed skipped'. But my script is not working and my tasks are in parallel. But I can't use join.
Below is my script :-
checkCatalogTasks();
function checkCatalogTasks() {
var grTask = new GlideRecord('sc_task');
var Task = gr.addQuery('request_item', current.sys_id);
Task.addOrCondition('active', true);
Task.addOrCondition('state', '!=', '3');
Task.addOrCondition('state', '!=', '4');
Task.addOrCondition('state', '!=', '7');
grTask.query();
if(grTask.hasNext()){
answer = false;
}
else{
answer = true;
}
}
Please help. Thanks in advance.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2018 03:57 AM
Thanks but I have already tried it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2018 12:02 AM
Hi Madhuchhanda.
Just a small change in your script and it should work.
Script
var query = 'active=true^ORstateIN3,4,7'
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item', current.sys_id); // u were using gr here instead of grTask
grTask.addEncodedQuery(query); // simplified filter conditions
grTask.query();
if(grTask.hasNext()){
answer = false;
}
else{
answer = true;
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks,
Priyanka

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2018 04:28 AM