Getting Cross Scope Error even after granting Cross Scope Privileges
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 02:55 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:28 AM
I cannot use single quotes ' ' as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:23 AM
but why to create script include from fix script?
I never came across any such requirement in my past experiences.
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
‎06-17-2025 03:27 AM
I have an eBonding Integration, so that when a button is clicked, all the script includes related to that catalog item will be moved from one instance to another. So my logic is in the UI Action's script.
But since it was not creating a script include in the Target instance, therefore I am first trying to execute it using Fix Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:36 AM
I have declared the cross scope previleges as well
These are the cross scopes that I have created. Along with this, there is one more which is for "Read" operation. That was by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 04:43 AM
Still I will recommend not to do this via script.
You can always migrate script includes via update set between 2 instances, why to use API for that?
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