Business Rule to Pause SLA of HR Task if HR case is suspended

Uttam Sai
Tera Contributor

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);

 

 

 

    
3 REPLIES 3

manjusha_
Kilo Sage

@Uttam Sai 

 

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

 

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!!

 

Jaspal Singh
Mega Patron
Mega Patron

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