- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 11:21 AM
Hi guys,
I created a condition in a workflow to wait for assigned tasks to be complete... however the workflow doesn't advance to the next activity after I have done the change on the task record that would allow the next activity to run.
This is what I have one the code.
// Set the variable 'answer' to true or false to indicate if the condition has been met or not.
answer = true;
var gr_tsk = new GlideRecord("change_task");
gr_tsk.addQuery('change_request', current.sys_id);
gr_tsk.addQuery('u_accept_task', '==', 'Yes');
gr_tsk.addQuery('wf_activity', '');
gr_tsk.query();
if (gr_tsk.next()) {
answer = true;
} else {
answer = false;
}
Thanks for your support.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2015 10:46 PM
The wait for script could then be something like this:
var gr_tsk = new GlideRecord("change_task");
gr_tsk.addEncodedQuery('state<3^change_request=' + current.sys_id);
// gr_tsk.addQuery('u_accept_task','Yes'); // I'm not sure/clear why you need this
//gr_tsk.addQuery('wf_activity', ''); // neither sure/clear why you need this.
gr_tsk.query();
if (gr_tsk.hasNext()) {
answer = false; // if there's at least one record open then continue waiting
} else {
answer = true; // if there's no records found then exit the wait for activity
}
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 01:52 PM
Jesus,
If you are doing these for manual change tasks, then for manual change tasks the 'parent' field is not populated with Change request.
The business rule which is resposnible to move the workflow on parent is 'SNC - Run Parent workflows', so you need to mimic that business rule to run on Change Task but instead of using 'parent' field use ;'change_request' field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 01:57 PM
Basically I need to enable a UI action based on the updates from the child change tasks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 02:03 PM
Also, what if I want to update the change request from the change task workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 02:09 PM
Mani,
Look at this post Re: I require a Workflow wait for condition to wait for 4 change tasks to complete before moving to ...
What's it possible there to use the same script for manual tasks?