- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 07:47 AM
Hello @all ,
I have the solution itself, but I'd appreciate some guidance to fully grasp its underlying mechanics and how it functions.
Requirement -
Basically the "Republish" button on kb article is not accesible for ownership group members it was only allowed to the knowledge admin and admin users. so our requirement was make it functional and visible to ownership group members as well. Hence I followed the below article. And provided souliton by "Sebastian" is worked for me I pasted the code in "KBCommon " script include.
It got worked succefully, However my question is how this get linked with republish functionality, because if we check the UI Action of "republish" button.
It has called "KBKnowledge" script include and inside that script include no any "republish" function is defined. And i found one more script include is called there "KBKnowledgeSNC" as shown in below screenshot.
So in that script include i found the function
So my question is adding code in the "kbcommon" script include how does my issue resolved. Can someone help me to understand the connection and work behind this?
@Sebastian R_
@
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 01:02 AM
Hi @Yogita11_ ,
this is working because of the extension-chain of the script include.
The extension is defined in line 2 of each script include "Object.extendsObject".
The chain looks the following:
KBKnowledge -> KBKnowledgeSNC -> KBCommon -> KBCommonSNC
So going through the function chain it looks like this
Call "canRepublish" in KBKnowledge.
If "canRepublish" is not defined in KBKnowledge, use the definition from KBKnowledgeSNC.
KBKnowledgeSNC.canRepublish is not defined in KBKnowledge or KBKnowledgeSNC.
So we go deeper and check KBCommon and then KBCommonSNC.
As you haven overwritten the function in KBCommon, that´s why it is working
See also this course to learn more about the extension of script includes: https://developer.servicenow.com/dev.do#!/learn/courses/xanadu/app_store_learnv2_scripting_xanadu_sc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 02:00 AM
Yes correct. ServiceNow uses this concept in lot of scripts where you have the readonly SNC Script Include and the writeable version to overwrite functionality.
So ServiceNow will always call "KBKnowledge" so that you can overwrite the methods there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 10:11 AM
My take on it is that in the original code only an admin can republish. In the custom code, which is a way to keep the existing logic as is and override it says that if the user is NOT an admin AND NOT a member/manager of the ownership group, deny access...so then it lets the ownership group have the access.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2025 01:02 AM
Hi @Yogita11_ ,
this is working because of the extension-chain of the script include.
The extension is defined in line 2 of each script include "Object.extendsObject".
The chain looks the following:
KBKnowledge -> KBKnowledgeSNC -> KBCommon -> KBCommonSNC
So going through the function chain it looks like this
Call "canRepublish" in KBKnowledge.
If "canRepublish" is not defined in KBKnowledge, use the definition from KBKnowledgeSNC.
KBKnowledgeSNC.canRepublish is not defined in KBKnowledge or KBKnowledgeSNC.
So we go deeper and check KBCommon and then KBCommonSNC.
As you haven overwritten the function in KBCommon, that´s why it is working
See also this course to learn more about the extension of script includes: https://developer.servicenow.com/dev.do#!/learn/courses/xanadu/app_store_learnv2_scripting_xanadu_sc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2025 07:29 AM - edited 07-02-2025 01:23 AM
Thanks for the information, @Sebastian R_
Can you please help me to explore some things, as we can see in the below screenshot "
However, this get extended from the "KBKnowledge" script include (editable) so we can override the function in this script include right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 02:00 AM
Yes correct. ServiceNow uses this concept in lot of scripts where you have the readonly SNC Script Include and the writeable version to overwrite functionality.
So ServiceNow will always call "KBKnowledge" so that you can overwrite the methods there.