- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2025 08:52 PM
I'm trying to use a scripted filter on my report. I want to read only the import set rows belonging to the most recent import set for a given table. So I will pass in the Import Set Row table name as a param and return the sys_id of the most recent import set for that table. (I actually return an array of a single element, for now.) My report will filter the import rows to those where Set.sys_id matches one of these values.
So I started by creating a client callable script include, accessible from all scopes, to take the table name as a param.
var ImportSetDetails = Class.create();
ImportSetDetails.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
/**
* Returns the sys_id of the newest import set created for @tableName
*/
getImportSetSysids: function(tableName) {
// returns an array
},
type: 'ImportSetDetails'
});
and an ACL:
The ACL has snc_internal.
Now the script include works fine. But when I invoke it through a list or through the report filter I get nothing. Adding print statements confirms that the script is not being invoked. The filter expression is:
javascript: new my_scope.ImportSetDetails().getImportSetSysids("my_scope_vendor_data");
This must be a permissions problem, but I set up the ACL on the script include. There are a number of posts on this problem, and the all discuss the ACL and making the script include callable. What else can I check?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2025 10:47 PM
gs.info() won't work if you are calling it from report filter condition. it's OOB behavior
Does it work for admins?
are you checking with snc_internal user on report?
The 'sandbox enabled' checkbox in ServiceNow's Xanadu release allows you to run scripts within a secure, restricted environment known as a sandbox. This sandbox limits the script's access to certain APIs and resources, enhancing security by preventing potentially harmful operations.
Example Use Case: Imagine you have a script include that processes user input from a client-side form. By enabling the 'sandbox enabled' checkbox, you ensure that this script runs in a controlled environment, reducing the risk of malicious code execution or unintended access to sensitive data.
More details here
Configuring Script sandbox property
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2025 09:25 PM
Hello @thomaskennedy , do you have Standbox check box available in script include, if so, can you enable the same and then try?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2025 10:47 PM
gs.info() won't work if you are calling it from report filter condition. it's OOB behavior
Does it work for admins?
are you checking with snc_internal user on report?
The 'sandbox enabled' checkbox in ServiceNow's Xanadu release allows you to run scripts within a secure, restricted environment known as a sandbox. This sandbox limits the script's access to certain APIs and resources, enhancing security by preventing potentially harmful operations.
Example Use Case: Imagine you have a script include that processes user input from a client-side form. By enabling the 'sandbox enabled' checkbox, you ensure that this script runs in a controlled environment, reducing the risk of malicious code execution or unintended access to sensitive data.
More details here
Configuring Script sandbox property
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2025 07:51 AM
Ankur,
You are correct that gs.info will not run when invoked through a filter. I looked over the article and do not see any downside to enabling sandbox behavior in this case, so I checked that box and it works fine now. That will be the plan unless I think of something that does not require the sandbox or an option that does not require JavaScript. Thank you!