- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-12-2024 01:50 AM
Hi
I am trying to serach for querying against 'sys_object_source' table in all the script fields in the instance. But the above code is not working please help me.
Help me to provide how to keep correct regular expressions.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-12-2024 02:04 AM
O really small though essential typo I made, here is working tested code:
(function (engine) {
// Remove code comments
var commentsRegEx = /\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm;
var commentsRemovedValue = engine.columnValue.replace(commentsRegEx, '');
var search_regex = /\bGlideRecord\(['"]sys_object_source['"]\)/gm;
// Create scan finding
if(search_regex.test(commentsRemovedValue)) {
engine.finding.increment();
}
})(engine);
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2024 03:19 AM
Hi @shivaadapa
you observation is correct. By any reasons I don't understand, the Column type check always exclude the untouched OOTB artifacts and only include the customized and custom artifacts. Therefore, I replaced most of my checks with other types.
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2024 03:24 AM
"By any reasons I don't understand"
It's just designed like that š Would be nicer to have a checkbox or something on a check to be able to include/exclude untouched out-of-the-box, though unfortunately its just this way and no one at ServiceNow is developing anymore on Instance Scan so probably will stay this way forever.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2024 10:50 PM
How should I check script fields are gliding against sys_object_source table. can I use any other checks?
please help me!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2024 10:52 PM - edited ā01-21-2024 10:53 PM
You are really making a mess of all your questions. I've already answered this in one of your other questions. We cannot help you if you are making such a mess of this.
"Like I mentioned in one of your other questions: if you want out-of-the-box findings also to appear: Script Only Check is your goto."
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-21-2024 11:18 PM
I already showed you that it's not giving custom ones also. so, that's why i am asking is there any another way?
please help me!