SQL Like queries in ServiceNow
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 03:30 AM
Whats the GlideQuery equivalent of:
select * from Employee where name like 'John%'
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 03:33 AM - edited ‎03-04-2024 03:34 AM
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!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 07:59 AM
Hi
You can try with
var gr = new GlideRecord('Employee')
gr.addQuery('field_name','LIKE' ,'John')