- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2016 09:08 AM
I need to report on all assets with a serial number containing 1 or more spaces anywhere in the value.
1) can wildcards be used in report and filter conditions? e.g. * " " *
2) how would i represent the space? escape sequence?
3) can REGEX be used in reporting?
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Problem Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 11:01 AM
Hi Hubert
You can create a Script Include which will have a function which returns comma separated sys_ids of the desired records. Then the same function can be used as a filter in your table.
E.g: If we want to create a report on the table sys_user where field phone contains any whitespace, we can write following Script Include:
var TestFilter = Class.create();
TestFilter.prototype = {
initialize: function() {
},
getFilter: function() {
var v = new GlideRecord('sys_user');
v.addQuery('phone', 'CONTAINS', ' ');
v.query();
return v;
},
type: 'TestFilter'
};
And then in the report, we can use following (without quotes):
'Business Phone' 'is one of' 'javascript:new TestFilter().getFilter()'
Please refer to Reference Qualifiers - ServiceNow Wiki for further details.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 11:01 AM
Hi Hubert
You can create a Script Include which will have a function which returns comma separated sys_ids of the desired records. Then the same function can be used as a filter in your table.
E.g: If we want to create a report on the table sys_user where field phone contains any whitespace, we can write following Script Include:
var TestFilter = Class.create();
TestFilter.prototype = {
initialize: function() {
},
getFilter: function() {
var v = new GlideRecord('sys_user');
v.addQuery('phone', 'CONTAINS', ' ');
v.query();
return v;
},
type: 'TestFilter'
};
And then in the report, we can use following (without quotes):
'Business Phone' 'is one of' 'javascript:new TestFilter().getFilter()'
Please refer to Reference Qualifiers - ServiceNow Wiki for further details.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2016 07:10 PM
This script include should be a client callable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 03:02 PM
Thanks, Ankush and Abhinay!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 05:42 PM
You can get a space as a literal that is not trimmed by using the search string "javascript:' '". You don't need a new script include just for this.