How to use "does not end with" in reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 12:25 PM
I need to show a list of user records where user id does not end with -a
"does not end with" is not available as an operator in reference field qualifier. Any other ideas in which it can be achieved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 12:41 PM
I'd suggest doing an advanced reference qualifier that calls a script include. Here is an example:
This is the "getApps" function in the "AccessRequestSI" script include (script include needs to be client callable). Your script will be simpler, with just one glide record query:
getApps: function(){
var what = current.variables.access;
var db = current.variables.database;
var ids = ' ';
if(what == 'application'){
var a = new GlideRecord('cmdb_ci_appl');
a.addQuery('sys_class_name','cmdb_ci_appl');
a.addQuery('u_allow_access_requests',true);
a.query();
while(a.next()){
if(ids.length > 0){
ids += (','+a.sys_id);
}
else{
ids = a.sys_id;
}
}
}
else if(db == ''){
var all = new GlideRecord('cmdb_ci_appl');
all.addQuery('sys_class_name','cmdb_ci_appl');
all.query();
while(all.next()){
if(ids.length > 0){
ids += (','+all.sys_id);
}
else{
ids = all.sys_id;
}
}
}
else if(db != ''){
var m2m = new GlideRecord('cmdb_rel_ci');
m2m.addQuery('child',db);
m2m.query();
while(m2m.next()){
if(m2m.parent.sys_class_name == 'cmdb_ci_appl' && m2m.parent.install_state != 7){
if(ids.length > 0){
ids += (','+m2m.parent.sys_id);
}
else{
ids = m2m.parent.sys_id;
}
}
}
}
return 'sys_idIN' + ids;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 12:54 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 01:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2017 01:41 PM
I'm looking for some sample on syntax that servicenow expects for regex. It doesn't work if I write it in standard way.
Regards
Bharat