Calling a private scope script include with scoped app
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 02:29 AM
Hi ServiceNow Experts,
I am developing a scoped app and have a requirement of executing a script include which is only accessible from a particular scope. This SI needs an input param to be passed dynamically every time scoped app is executed. The scope of SI cannot be changed to "accessible to all scopes".
What are ways of executing this SI from a scoped app?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 11:13 PM
Hm, even though you have found a solution, can you tell us why you go with this solution instead of creating a 'Accessable from all scopes' Script Include of this scoped app?
IMHO this would be a better way than having a changing sys_properties record (you will cause for lots of sys_update_xml records!).
Depends of course on your business case, but it would still be a good idea to explain to future readers why this solution is best for your business case 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 12:03 AM
Reason why I am not changing the scope to "Accessible from all scopes" is because the SI is ServiceNow OOB SI and don't want to play with it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2022 01:04 AM
Totally understandable, but you could create a new Script Include that acts as a wrapper for this.
You could also do this, given that OOTBSCRIPTINCLUDE is the name of the Script Include you dont want to touch, and MYSCRIPTINCLUDE is the name of the 'Accessable from all scopes':
var MYSCRIPTINCLUDE = Class.create();
MYSCRIPTINCLUDE.prototype = Object.extendsObject(OOTBSCRIPTINCLUDE, {
type: 'MYSCRIPTINCLUDE'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 10:09 PM
You can also make a script include in the same scope as the private script include (global ?) that is callable from all scopes.
From that script include you then call the private script include.
That should work
