Global system script includes not available from scopes

john_roberts
Mega Guru

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_...."

David Gatley

24 REPLIES 24

Did you get any solution on this.I am also facing same issue.


prasad,



I have figured it out.



Here are the steps that I had to do to get Glide Ajax to work in a custom app (Mine is setup to be triggered by clicking a button)   (Example included)



1.   Create UI Action.
2.   Make sure the UI action has the 'Client' check box checked


3.   Put a JS method name in the 'OnClick' field of the UI Action.   This is the key that turns the UI action into a client side script and makes the Gide Axjax ojbect visable


4.   Make your method you put in the 'OnClick' field
5.   Setup the GlideAjax object and call your script include.
6.   Script include must use:   (near the top of the file)


YourScriptIncludeName.prototype = { Object.extendsObject(global.AbstractAjaxProcessor
instead of:


YourScriptIncludeName.prototype = {



7.   Script include cannot have a:
initialize: function() {


//some code


},


I personally made my own like this:


_init: function() {
//some code
},




somePublicMethodCalledByAjax:   function() {


        this._init();
//the rest of your code


},




Example UI Script Ajax call:



function isAllowedToDoSomething() {


      var ajax = new GlideAjax('full path to your scoped app script include.   Look in the Api Name field of the script include to find it');


      ajax.addParam('sysparm_name', 'isAllowedToDoSomething);   //name of the public method you want to call in your script include


      ajax.getXML(parseIsAllowedToDoSomething);


}



//the response var is auto made by the system


function parseIsAllowedToDoSomething(response) {


      if(response.responseXML.documentElement.getAttribute('answer') === "true") {


              alert("Granted.");


      } else if(response.responseXML.documentElement.getAttribute('answer') === "false") {


              alert("Denied.");


      }


}


Thank you Travis


You're welcome


Yadin
Tera Contributor

5 years later and this is still a problem that hasn't been fixed??  How are these things "global" when they are in fact very much NOT global?  How are we supposed to develop an "application" that people can download from the store if we can't actually leverage the platform??  The simplest functions are just not possible thus far, like cleaning up an import table!