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:15 AM
Hi @Aniket Bhanse
you have a script include in a scoped app and you want to have the same script include in a global scope?
If so, deactivate the scoped and re-create into a global one.
Or what is exactly the issue? I am not sure I understand it clearly
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 03:20 AM
Not exactly.
My script include do not exist in the environment. I am trying to create script include in the global application and my fix script is in Scoped application.
(I am doing it in this way because we are using such logic in one of our functionality)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 03:20 AM - edited 06-17-2025 03:23 AM
now I noticed that there might be a problem with a quote character
SIGr.script = `
there is not ' but `... try to check this as well.
SIGr.script = ` //HERE
var MyNewScriptInclude = Class.create();
MyNewScriptInclude.prototype = {
initialize: function() {
},
myFunction: function() {
// Your script logic here
return 'Hello from MyNewScriptInclude!';
},
type: 'MyNewScriptInclude'
};
`; //HERE
SIGr.client_callable = true;
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 03:25 AM
Yes, I have done that purposefully because it was not accepting double quotes "" for the script include script. What should I use instead of that?