Business Rule to Pause SLA of HR Task if HR case is suspended
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 08:33 AM - edited 06-30-2023 08:35 AM
Hello All,
I am trying to write a before business rule, which works on insert or update , should Pause SLA of all related HR Task(sn_hr_core_task) if HR case(sn_hr_core_case) is suspended or awaiting approval .Below is the logic i am trying to use and not sure how we can pause the SLA . Kindly suggest .
function executeRule(current, previous /*null when async*/) {
var hrcase = current.number;
var gr_task = new GlideRecord('sn_hr_core_task');
gr_task.addQuery('parent',hrcase);
gr_task.Query();
while (gr_task.next()) {
//Delete each record in the query result set
if (current.state == '11' || current.state == '24')
{
gr_task.pauseSLA();
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 09:08 AM
In Task SLA pause condition use condition as below
parent.state changes to suspended .
If above condition does not work then you need glide sla definition and update state field of sla.
Let me know if you need more help
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact
Thanks,
Manjusha Bangale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 09:12 AM
Hi @manjusha_ ,
Thanks for your response 🙂
SLA pause condition didn't work.
Could you please help me with the script to update state field of sla.
Thank you so much!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 09:18 AM
Hi,
Suggestion will be to add a specific state value to all HR tasks when HR Case is suspended or awaiting approval.
Once done, use this state value at HR Task in SLA definitions Pause Condition.
Not necessarily state but any other field that you can use in SLA Defnition Pause condition for HR Task