Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 06:13 PM
I want to query sys_db_object .. where the name starts with cmdb
Solved! Go to Solution.
Labels:
- Labels:
-
Scripting and Coding
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 06:18 PM
Please see below example, Edit: Updated query
var queryString = "nameSTARTSWITHcmdb";
var gr = new GlideRecord('sys_db_object');
gr.addEncodedQuery(queryString);
gr.query();
while (gr.next()) {
gs.addInfoMessage(gr.sys_id);
}
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 06:18 PM
Please see below example, Edit: Updated query
var queryString = "nameSTARTSWITHcmdb";
var gr = new GlideRecord('sys_db_object');
gr.addEncodedQuery(queryString);
gr.query();
while (gr.next()) {
gs.addInfoMessage(gr.sys_id);
}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2020 09:25 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2023 03:38 AM
You can use -
var gr = new GlideRecord("sys_db_object");
gr.addQuery('name' , 'STARTSWITH' , 'cmdb');