workflow for ritm> need to create workflow activity on if sctask is closed skipped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 02:24 PM - edited 02-27-2025 02:29 PM
So, I have a workflow for a request item that creates catalog tasks. I would like to have the "IF" workflow activity to check if the sctask before it was closed skipped and if so follow the alternate path. I have tried it and it doesnt seem to skip and follow the alternate path
// Check if the SCTASK in this RITM is "Closed Skipped"
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('request_item', current.sys_id);
taskGR.addQuery('state', 4); // State 4 = Closed Skipped
taskGR.query();
if (taskGR.next()) {
answer = true;
} else {
answer = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 04:58 AM
Hi @RBlor, any luck on this, here is the full script:
answer = ifScript();
function ifScript() {
// Check if the SCTASK in this RITM is "Closed Skipped"
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('request_item', current.sys_id);
taskGR.addQuery('state', 4); // State 4 = Closed Skipped
taskGR.query();
if (taskGR.hasNext()) {
return 'yes';
} else {
return 'no';
}
}
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 09:52 AM
so this is progress. yes the workflow moved forward with no error, BUT i did close skipped and it moved forward as no
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 12:21 PM
Hope your previous activity in the workflow "Catalog task" has wait checkbox. Also, try adding timer activity for 1 sec prior to IF condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 06:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 10:24 PM