Incident and Incident Task SLAs priorities

Federico Fiume
Tera Contributor

Hi all, 
we are trying to relate Incident and Incident Tasks for SLAs, we have connected the ITASK SLA to the incident.priority so when the incident's priority changes a new SLA of ITASK should be created but the problem is that happens only when the ITASK is refreshed or opened, if it is already open on a tab I don't see any changes.


Maybe there's something wrong in our business rule, I know that "display" is not the best, but I can't get it working with "before".
Table: itask
When: DISPLAY (and Query is checked)
Advanced script:

(function executeRule(current, previous /*null when async*/) {
    current.work_notes = "test change Priority";
    current.update();
})(current, previous);


What happens now:
1. I have a P4 INC (SLA is set on INC)
2. I create an ITASK (ITASK SLA is triggered based on incident.priority)
3. I change the INC to a P2 (original SLA on INC is canceled, new P2 SLA is created)
4. In the ITASK now I show P2 INC priority (but the ITASK SLA does not get updated, it changes only when I refresh the ITASK)

 

What do you suggest?
Please let me know if you need further informations.

Thanks a lot,
Federico

5 REPLIES 5

Dubz
Mega Sage

Because you have extended the field from the master INC there is actually nothing changing on the ITASK to process the new SLA requirement, it's displaying a new priority but no new data has been submitted on the form.

It might be better if you create a new field on the ITASK form for the priority and set it up to mirror whatever is on the INC. You can update it using an after update business rule whenever the priority on the master INC changes and then it will proc the new SLA.

Hi David, thanks for your reply.

1) Now the ITASK SLA is based on the Priority and not on the incident.priority
2) I set the br to AFTER, and set "Priority same as Incident.Priority" in the Actions
3) the advanced script is still as it was before

Please let me know if I've to do something more or I did something wrong because now the ITASK SLA is not changing anymore, is still the old one.


You need to set the after BR on the INC table so that when the priority changes there any related ITASKs are updated as well. Something like this:

 

var gr = new GlideRecord('incident_task');
gr.addQuery('parent', current.sys_id);
gr.query();

while(gr.next()){
gr.priority = current.priority;
gr.update();
}

Hi David,

I set the BR like this:

Table: incident
When: after (insert + update)
Advanced script:

(function executeRule(current, previous /*null when async*/) {

var gr = new GlideRecord('incident_task');
gr.addQuery('parent', current.sys_id);
gr.query();

while(gr.next()){
gr.priority = current.priority;
gr.work_notes = "Priority has been changed";
gr.update();
}
	
})(current, previous);

 

 

But unfortunately nothing changed, is not working.

Thanks,
Federico