Global system script includes not available from scopes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2015 10:02 AM
There are many system provided script includes that are not accessible from custom scopes. Even though they are in the global scope they are blocked because the "accessible from" value is set to "this scope only". This is going to create a huge issue and drive everyone to make a lot of changes to system scripts.
First ones I came across were commonly used, JSUtil and TableUtils.
Changing the "accessible from" resolves the issue. Platform wide system scripts should be set to be available in all scopes or just not have the setting apply if scope is global.
"Illegal access to private script include TableUtils in scope rhino.global being called from scope x_...."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2015 06:55 PM
Darn, I need to add XMLHelper to this list. This is a very nice utility that will convert XML to JSON. I'm not sure why this utility is not available outside the global scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2015 12:50 PM
XML Helper is available in the scoped api you just need to initiate with global in front. So for XMLHelper it should look like
var xmlhelper = new global.XMLHelper();
http://wiki.servicenow.com/index.php?title=Scripting_in_Scoped_Applications#Calling_Script_Includes
Checkout section 3.2.3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2015 01:08 PM
Darrin,
Have you tried that while in a scope? When using it in the "Scripts - Background" in a non global scope, I get this:
Evaluator: java.lang.SecurityException: Illegal access to private script include XMLHelper in scope rhino.global being called from scope x_xma_testing6
Caused by error in script at line 1
==> 1: var xmlhelper = new global.XMLHelper();
Evaluator: java.lang.SecurityException: Illegal access to private script include XMLHelper in scope rhino.global being called from scope x_xma_testing6
Caused by error in script at line -1
Background message, type:error, message: Illegal access to private script include XMLHelper in scope rhino.global being called from scope x_xma_testing6
This was the script I tried:
var xmlhelper = new global.XMLHelper();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2015 01:14 PM
Yes I have with no issues. Did you make sure to add gs.include('XMLHelper');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2015 02:07 PM
Really? Dude, that would be awesome, but I can't seem to get it working. This is my newly zbooted instance. I created the "testing6" application and this is my Scripts - Background:
And this is the output:
Have you changed the "Accessible from" setting in the XMLHelper Script Include record. This is what it looks like out of the box:
If you have this working I would definitely buy you a beer... or two or three!