- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 02:27 AM
Hi Everyone,
I want to set SLA status to cancel when a user changes the HR task to canceled state. Please let me know if this is possible.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 02:39 AM
It is not directly possible on SLA table, you need to run BR
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 02:45 AM
Hi @SiddharthG55401 ,
Yes, it is possible to set the SLA status to "Canceled" when the HR task state is changed to "Canceled." This can be achieved by using a Business Rule on the sn_hr_core_task table to update the SLA status.
if (current.state == 'canceled') { // Check if the state is set to "Canceled"
var slaGr = new GlideRecord('task_sla');
slaGr.addQuery('task', current.sys_id); // Fetch SLAs linked to this task
slaGr.query();
while (slaGr.next()) {
slaGr.setValue('stage', 'canceled'); // Update SLA stage to "Canceled"
slaGr.update();
}
}
Replace 'canceled' with the exact value of the "Canceled" state in your HR task state dictionary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 06:43 AM
Hi @SiddharthG55401 ,
thanks for marking my response helpful , multi solution acceptance is enabled.