How to achieve below requirement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Team,
- The RITM is placed On Hold and its SLA clock is paused only when all linked SCTASKs are in one of the following states or combination of states:
- When all linked SCTASKS have the following combination
- On Hold -> Awaiting Caller (all active tasks are in this substate)
- Completed (all remaining active tasks have a substate of Awaiting Caller)
- Cancelled (all remaining active tasks have a substate of Awaiting Caller)
- Cancelled and Completed (all remaining active tasks have a substate of Awaiting Caller)
- If any linked SCTASK is in an active working status that is not “On Hold" -> "Awaiting Caller”, the RITM SLA clock continues to run.
I have tried using directly from SLA, but it is not working. How Can I achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
39m ago
Hi @Gopal14
Refer this post on similar requirement: How to pause SLA on RITM during execution of certain Catalog Tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
27m ago
Hi @Gopal14 ,
SLA conditions only evaluate fields on the RITM (`sc_req_item`).
They cannot directly check the states of linked Catalog Tasks (`sc_task`).
That’s why your SLA pause logic doesn’t trigger correctly.
You need to drive the RITM state based on SCTASK states using a Business Rule or Script Include. Then configure the SLA to pause when RITM = On Hold.
Implementation Steps
1. Business Rule on `sc_task`
Table: `sc_task`
When: after update of `state` or `substate`
Script logic:
Query all tasks linked to the same RITM (`request_item = current.request_item`).
Check if all active tasks are in one of these states:
On Hold → Awaiting Caller
Completed
Cancelled
Combination of Completed + Cancelled + Awaiting Caller
If true → update parent RITM (`sc_req_item.state = On Hold`).
Else → set RITM back to In Progress.
2. SLA Definition
Pause condition: `state == On Hold` on the RITM.
Resume condition: when RITM returns to In Progress.
Example Script (Business Rule)
`(function executeRule(current, previous) {
var ritmId = current.request_item;
var tasks = new GlideRecord('sc_task');
tasks.addQuery('request_item', ritmId);
tasks.addQuery('active', true);
tasks.query();
var allAwaitingCaller = true;
while (tasks.next()) {
var state = tasks.getValue('state');
var substate = tasks.getValue('substate');
if (!(state == 'On Hold' && substate == 'Awaiting Caller') &&
state != 'Completed' &&
state != 'Cancelled') {
allAwaitingCaller = false;
break;
}
}
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(ritmId)) {
ritm.state = allAwaitingCaller ? 'On Hold' : 'In Progress';
ritm.update();
}
})();
Business Rule evaluates SCTASK states and updates RITM state accordingly.
SLA Definition pauses when RITM = On Hold.
This ensures SLA clock only pauses when all tasks meet your Awaiting Caller/Completed/Cancelled condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
26m ago
Hi Gopal,
What you are trying to achieve is definitely possible, but I would not recommend handling this logic directly only from the SLA definition because the condition becomes too complex when evaluating multiple SCTASK states together.
A cleaner approach is usually:
Create a Business Rule on sc_task
Every time a task changes state, evaluate all active child SCTASKs for the parent RITM
If all active tasks are On hold -> Awaiting User, then place the RITM On Hold
Otherwise move the RITM back to a working state so the SLA continues running normally
Something like this could work as a starting point:
(function executeRule(current, previous /*null when async*/) {
if (!current.request_item)
return;
var ritm = current.request_item.getRefRecord();
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item', ritm.sys_id);
grTask.addActiveQuery();
grTask.query();
var shouldHold = true;
while (grTask.next()) {
// Task is not On Hold
if (grTask.state != 3) { // adjust based on your On Hold value
shouldHold = false;
break;
}
// Substate is not Awaiting Caller
if (grTask.hold_reason != 'Awaiting Caller') {
shouldHold = false;
break;
}
}
if (shouldHold) {
ritm.state = 3; // On Hold
ritm.hold_reason = 'Awaiting Caller';
} else {
ritm.state = 2; // Work In Progress
ritm.hold_reason = '';
}
ritm.update();
})(current, previous);Then, in your SLA definition, you can simply configure the pause condition based on the RITM itself:
State = On Hold AND Hold Reason = Awaiting Caller
This keeps the SLA logic simple and moves the complex evaluation to the task layer, which is much easier to troubleshoot and maintain long term.
One additional recommendation:
be careful with recursive updates if you already have Business Rules running on the RITM table. In some cases it is better to use setWorkflow(false) before the update depending on your environment.
Hope this helps!
Regards,
Juan
If my reply was Helpful, please mark the answer as correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
21m ago
Hi there @Gopal14 \
Hi Gopal,
Try creating a Business Rule on the sc_task table that runs whenever a task state changes. In the script, query all SCTASKs linked to the RITM and check whether all active tasks are in On Hold -> Awaiting Caller, while the remaining tasks are either Completed or Cancelled. Only in that scenario should the RITM be moved to On Hold and the SLA paused.
If even one linked SCTASK is still in an active working state such as Open, Work in Progress, Pending, etc., the RITM SLA should continue running. this type of solution needs more than a OOB SLA condition, i would suggest a scripted approach.
Kind Regards,
Azar
Serivenow Rising Star ⭐
Developer @ KPMG.
