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

Looks like the parent field on incident task isn't populated OOB, change to incident as below (always check field names etc when you get scripts off here :)):

 

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

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