Can we call script include from SLA filter condition?

neethu4
Giga Expert

Hi

Can we call script include from a SLA start condition using below?

javascript:newGetInSys().getinc();

I user the above method to call the script include function but it is not triggering from the SLA start condition.

I have verified the script and it is working in background script.

Thanks,

Neethu

 

21 REPLIES 21

Yes,the script include return the sys id and i have added the filter condition sys id "contains" which didn't work and tried "is one of" it also not working.Client callable is true

It is not going inside the script include

sorry for this question. may i know why are you calling the script include inside the sla ? can you please add your use case ? 

also please add some screenshot of your script include and filter configuration 

 

here i have tested and its working. 

 

find_real_file.png

 

Sla condition

 

find_real_file.png

 

result:

 

find_real_file.png

 

If my answer helped you, kindly mark it as correct and helpful.

 javascript: new GetInc().getsysID();

The script include is used to get the sys id of incident where previous assignment group is GroupName1 and current assignment group is GroupName2 or vice versa.This script is giving the sys id of incident when executing in backgroun script

Script Include:

var arr = [];
var ar = [];
var sys;
var gr = new GlideRecord('metric_instance');
gr.addEncodedQuery('definition=def_name^valueLIKEGroupName 1^ORvalueLIKEGroupName 2^end=NULL');
gr.query();
while(gr.next()){
//gs.log('Total Count: ' + gr.id );
sys= new GlideRecord('metric_instance');
sys.addEncodedQuery('definition=def_name');
sys.addQuery('id',gr.id);
sys.orderByDesc('start');
sys.setLimit(2);
sys.query();
arr.splice(0, 2);
while(sys.next()){
arr.push(sys.value.toString());
}
ar.splice(0, 1);
if((arr[0]=="GroupName 1" && arr[1]=="GroupName 2")||(arr[0]=="GroupName 1" && arr[1]=="GroupName 2"))
{
ar.push(sys.id.toString());
gs.log("*****************Success****************: " + ar);
}
}
}
}
return 'sys_idIN'+ar.join();
}

 

if you see my above screenshot, i used global prefix so can you use that as well in filter condition

would it be possible if you can add some screenshot of you script include and filter condition ?

eg:

 

sys_id | is one of | javascript: new global.<script include name>.<function name>