Getting Cross Scope Error even after granting Cross Scope Privileges

Aniket Bhanse
Tera Guru

I am trying to create a simple script include from Fix script (Scoped Application) in the global application (The script include should be created in the global application) and I am getting the error Cross Scope Error. And I have granted the Cross Scope already of Create, Write and Read and Execute API as well. But still the error is there. 

var SIGr = new GlideRecord('sys_script_include');
SIGr.initialize();

SIGr.name = 'MyNewScriptInclude';
SIGr.api_name = 'global.MyNewScriptInclude'; 
SIGr.script = `
var MyNewScriptInclude = Class.create();
MyNewScriptInclude.prototype = {
    initialize: function() {
    },

    myFunction: function() {
        // Your script logic here
        return 'Hello from MyNewScriptInclude!';
    },

    type: 'MyNewScriptInclude'
};
`;
SIGr.client_callable = true;
SIGr.active = true;
SIGr.description = 'This is a sample script include.';
SIGr.sys_scope = "global";
var sysId = SIGr.insert();

if (sysId) {
    gs.info("Script Include created with sys_id: " + sysId);
} else {
    gs.error("Failed to create Script Include. Check for existing sys_id or name conflicts.");
}

 

Please suggest what should I do.

Thank you

18 REPLIES 18

@Ankur Bawiskar 

 

I was using Fix script and was getting the error. I have now used the Background script and using the code which you sent above with the Cross Scope Privilege and the Table's "Create" checkbox checked. 

I can see the message that script include is created but when I check the script include table, the scrpt include is not created. And in th background script, I am getting the error as "

Access to api 'put(sys_script_include.name)' from scope 'scoped_app' has been refused due to the api's cross-scope access policy. 

 Note: I have updated the scoped app name due to privacy in the above message.

The Cross Scope Image that you provided above, is that for same scoped App? I am not getting why it is blocking me. 

@Aniket Bhanse 

yes it's for the same scoped app.

It did work for me with those settings.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 

 

I tried in one of the other instances as well. 
Still getting the same error. 
Screenshot 2025-06-18 161631.pngScreenshot 2025-06-18 161816.png

 I am using the exact same code with lines commented what you have used. But still the error. Same Cross Scope. 

Note: This is not the same instance. It is some other instance that I am trying now. 

 

Screenshot 2025-06-18 161912.pngScreenshot 2025-06-18 161932.png

@Aniket Bhanse 

not sure but it did work for me

I was using a custom scoped app from background script.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader