Need help in understanding the OOTB script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 06:20 AM
Hi All,
We are working on a requirement where we need to modify the OOTB script. We need to comment out two lines that are restricting our script. Can anyone help us understand the script? Thanks.
Below are the two lines that need to be commented.
Function that is calling
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 06:58 AM
Hi @bhargavi9,
The method you refer to is part of the Script Include ('class'): KBFanoutManagerSNC.
ServiceNow have provided a 'subclass' and Script Include for you to override this method as you require. The subclass and Script Include you require is: KBFanoutManager
Within this Script Include ('KBFanoutManager') you can update as you require without affecting the parent and base class.
The syntax would be as below.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
//Template
// functionNameYouWantToOverride: function() {
// ...
// },
//For your specific requirement:
var KBFanoutManager = Class.create();
KBFanoutManager.prototype = Object.extendsObject(KBFanoutManagerSNC, {
notifyAuthorReviser: function(obj,event_name,current) {
if(obj.class_name == 'kb_knowledge_block') return;
var author_reviser = [];
var knowledge_gr = new GlideRecord('kb_knowledge');
knowledge_gr.addActiveQuery();
knowledge_gr.setWorkflow(false);
if(current.object_id.article_id.nil())
knowledge_gr.addQuery('sys_id',current.object_id.sys_id);
else
knowledge_gr.addQuery('article_id',current.object_id.article_id);
knowledge_gr.query();
while(knowledge_gr.next()) {
if(knowledge_gr.revised_by && knowledge_gr.revised_by != current.actor_id && new ArrayUtil().indexOf(author_reviser,knowledge_gr.revised_by) == -1 ) {
//if(!this.canNotify(knowledge_gr.revised_by,current))
//continue;
obj.receiver = knowledge_gr.revised_by.first_name+'';
gs.eventQueue(event_name,current,knowledge_gr.revised_by,new JSON().encode(obj));
author_reviser.push(knowledge_gr.revised_by+'');
}
else if(!knowledge_gr.revised_by && knowledge_gr.author != current.actor_id && new ArrayUtil().indexOf(author_reviser,knowledge_gr.author) == -1) {
//if(!this.canNotify(knowledge_gr.author,current))
//continue;
obj.receiver = knowledge_gr.author.first_name+'';
gs.eventQueue(event_name,current,knowledge_gr.author,new JSON().encode(obj));
author_reviser.push(knowledge_gr.author+'');
}
}
},
type: 'KBFanoutManager'
});