I want to cancel the activity in workflow based on wf_context and wf_excuting table using runscript?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 04:07 AM - edited 09-13-2024 08:23 AM
Hello all,
I need some help for cancelling one activity which was the second workflow for ritm. when i trigger the second workflow and trying to cancel based on conditions but its not getting cancelled. Can anyone please help me on this issue.
It STILL gives me the original workflow_context and not the currently executing one, even though printing out the value.
This is the second workflow, when executing to cancel the activity its taking to first workflow activities.
Executed flow workflow:
Script updating below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2024 06:08 AM
var wfContext = new GlideRecord('wf_context');
wfContext.addQuery('sys_id', current.context);
wfContext.query();
while (wfContext.next())
{
var wfActivity = new GlideRecord('wf_executing');
wfActivity.addEncodedQuery('context='+wfContext.sys_id+'^activity.name=10mins^state=waiting);
wfActivity.query();
if (wfActivity.next()) {
}
}