SQL Like queries in ServiceNow

nidhi_hassan
Kilo Contributor

Whats the GlideQuery equivalent of:

select * from Employee where name like 'John%'

2 REPLIES 2

_Gaurav
Kilo Sage

Hi @nidhi_hassan 
var gr = new GlideRecord('Employee');

gr.addQuery('name','LIKE','John');

gr.query();

if(gr.next()){

//use the gr object to get the value

}

 

 

Please mark this as helpful and accept it as a solution if this works for you.
Thanks!

Parth_Poriya
Tera Expert

Hi

 

You can try with

var gr = new GlideRecord('Employee')

gr.addQuery('field_name','LIKE' ,'John')