Attaching SLA to incidents where it is not attached
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 05:47 AM
Hi All,
We have some incidents where the SLA definitions did not attach and hence due date is not calculated. The requirement is to run a script(background script/schedule job) to attach SLA based on the priority,e.g:- if Priyority is p4, 'P4 SLA Resolution' SLA should attach.
till now I have got the following script-
var ag = new GlideRecord('incident');
var a ;
ag.addEncodedQuery('u_due_dateISEMPTY');
ag.query();
while(ag.next()){
a = ag.priority;
if(a == 'p5'){
gs.print('p5');
}}
But I am not quite sure how to attach the SLA definitions from task_sla table in this script. Any help is appreciated. Thanks.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 05:52 AM
How about the repair SLA function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 06:19 AM
Issue is where SLA is not attached, we dont have SLA records for those incidents in task_sla table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 05:54 AM
SLAs will be attached to the incidents if Start condition mentioned in SLA matches with current record values.
If any incident do not have any SLA then it is not matching any start condition in SLA definition.
For Ex: If you have one SLA with condition as "active is true and Priority is 1" then any update on Incident having Active true and Priority as 1 would have the SLA attached automatically.
If initially the same incident had Priority as 2 and then some one updated it as Priority 1, then also it should automatically attach the SLA.
Now you just need to compare start condition of the SLA and the incident values and modify accordingly.
Hope it is clear.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2019 06:18 AM
Hi Ali,
We have already tried this. But it is not working. Thanks.