The CreatorCon Call for Content is officially open! Get started here.

want to change SLA status to cancel when HR task changes to canceled state in HRSD

SiddharthG55401
Tera Contributor

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.

SiddharthG55401_0-1734517557879.png

 

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @SiddharthG55401 

 

It is not directly possible on SLA table, you need to run BR

 

https://www.servicenow.com/community/itsm-forum/how-to-stop-sla-based-on-catalog-task-state-field-ch...

*************************************************************************************************************
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]

****************************************************************************************************************

View solution in original post

Community Alums
Not applicable

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.

View solution in original post

10 REPLIES 10

 

Hi @SiddharthG55401 ,

 

thanks for marking my response helpful , multi solution acceptance is enabled.