Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to exclude CIs from business rule using system property

Community Alums
Not applicable

i have created a system property with 20 cis sys ids how can i exclude these 20 cis in business rule can any one help on this

 var intask= new GlideRecord('incident');
intask.addEncodedQuery('sys_id=' + current.task);
intask.addEncodedQuery(sys_id', 'IN' , gs.getProperty('exclude_cis'));
 
1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @Community Alums ,

form where you wan these Ci's to be excluded? from being updated?

If so, you can created a business, executing before update.

and try this logic to exclude particular 20 sys_ids:

var sys_ids = 'sys_id1, sys_id2, sys_id3........... ,sys_id20' // add all the sysids here.
var exclude = sys_ids.contains(current.sys_id); 
//var exclude = sys_ids.includes(current.sys_id); //use any one of them, both work same 
if(exclude=true) {
   current.setAbortAction(true);
}

 

Thanks,

Hope this helps.

If my response turns useful, please mark it helpful and accept solution.

View solution in original post

1 REPLY 1

Community Alums
Not applicable

Hi @Community Alums ,

form where you wan these Ci's to be excluded? from being updated?

If so, you can created a business, executing before update.

and try this logic to exclude particular 20 sys_ids:

var sys_ids = 'sys_id1, sys_id2, sys_id3........... ,sys_id20' // add all the sysids here.
var exclude = sys_ids.contains(current.sys_id); 
//var exclude = sys_ids.includes(current.sys_id); //use any one of them, both work same 
if(exclude=true) {
   current.setAbortAction(true);
}

 

Thanks,

Hope this helps.

If my response turns useful, please mark it helpful and accept solution.