- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 12:25 AM
Hi guys, I need to override two functions in script include which is 'This item is read-only based on its protection policy'
how can I resolve it?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 12:55 AM
Yes you can extend it similar to what I posted.
InteractionFacadeCustom = Class.create();
InteractionFacadeCustom.prototype = Object.extendsObject(InteractionFacade, {
functionNameYouWantToOverride: function() {
...
},
type: "InteractionFacadeCustom"
});
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 12:30 AM
Hi there,
2 things jump in mind.
You could create a new Script Include, which extends the current one. In that new Script Include, you could just add a function with the same name. You could then just reference that new Script Include and Function.
Other possibility. For some Script Includes, out-of-the-box there is a read-only version and already an extended version which is intended to edit. This extended version is already the one which scripting etc is pointing to.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 12:32 AM
Hi Serj,
You can create a new script include and extend the readonly script include and add the function there.
First check if there is an additional script include with the same name without SNC there OOB they have created one for update purpose. If that is not there then you can use this approach,
Update the name of readonly script include in there readonlyscriptinlcudename.
and add the function which you need to update here.
function to be update is updatefunction
Your new script include will look like this: add the Object.extendsObject
var newscriptinclude= Class.create();
newscriptinclude.prototype = Object.extendsObject(readonlyscriptinlcudename, {
updatefunction :function(){
},
type: 'newscriptinclude'
});
Thanks,
CB

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 12:35 AM
Here an example of what I mean with some out-of-the-box Script Includes which already have an extended Script Include, which you could edit:
Script Include:
KBKnowledgeBase
and
KBKnowledgeBaseSNC
Code of the KBKnowledgeBase:
KBKnowledgeBase = Class.create();
KBKnowledgeBase.prototype = Object.extendsObject(KBKnowledgeBaseSNC, {
type: "KBKnowledgeBase"
});
So you could just add the function name you are after, and add your code for example. Again it depends obviously if you have such a Script Include. If not, set it up, and change your script/reference etc. to point to this extended script include.
SNC being the read-only one. The non SNC the extended Script Include which you can edit. for example to override out-of-the-box functions in the SNC version.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 12:47 AM
if my read-only script without SNC can i extend it ?
My read-only script InteractionFacade
InteractionFacadeCustom = Class.create();
InteractionFacadeCustom.prototype = Object.extendsObject(InteractionFacade,{
} ?