- 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-18-2024 04:36 AM
maximum of them are custom, but i am not getting all of those records as findings.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-18-2024 04:37 AM
Please share details.
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:00 AM
In my instance i checked in one of the table script contains GlideRecord("sys_object_source
i am having these records but these are not getting as findings using your code:
please help me!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-19-2024 03:16 AM
These look out-of-the-box, can you confirm? Because (as also mentioned in one of your other questions which is still open): this check won't create findings on out-of-the-box records, only on modified/custom records.
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:22 AM
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.
Please do handle also your other posts. Follow-up, mark an answer as helpful if so, mark an answer as correct if so. So far you are not showing any appreciation at all.
We all are doing this for free in our own time just to help. Show some appreciation in return.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field