Does not contain

Akhil kumar Avu
Tera Contributor

Hi,

I want to filter records on incident table with reference field "assignment_group doesn't contain network". 

 

var gr = new GlideRecord('incident');

gr.query(),

if(gr.assignment_group.name!="net") //I have used this way and tried with indexOf but it is not working.  i want to filter "assignment_group doesn't contain net" through only  if condition not encoded query

{

 

}         

Thanks in advance!!

1 ACCEPTED SOLUTION

Hi 

You can try this

below code check if assignment group name does not have word 'network'  and prints the incident number.

var gr = new GlideRecord('incident');
gr.query();
while(gr.next()){
        if(gr.assignment_group.name.toLowerCase().indexOf('network') < 0){
                gs.info(gr.number);
        }
}

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

10 REPLIES 10

Just read your message the you want to use if condition the please use below:-

 

var gr = new GlideRecord('incident');
gr.query(),
while(gr.next()) 
{
var name=gr.assignment_group.name;
if(name.toLowerCase().indexOf('net') == -1)
{
gs.info(gr.number);
}
}  

 

Please mark my answer as correct based on Impact.