- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2024 10:46 PM
Hello guys,
There is an OOTB script include with getapprovers function.
getApprovers: function(knowledgeGR) {
if (this.isVersioningInstalled() && gs.getProperty("glide.knowman.ownership_group.enabled",'false') +'' == 'true') {
var users = new KBOwnershipGroup().getOwnershipGroupMembers(knowledgeGR);
if (gs.getProperty("glide.knowman.ownership_group.allow_self_approval", 'true') == 'false') {
var author = (knowledgeGR.revised_by && knowledgeGR.revised_by != '') ? knowledgeGR.getValue("revised_by") : knowledgeGR.getValue("author");
if (users.indexOf(author) != -1)
users.splice(users.indexOf(author), 1);
}
if (users.length > 0) {
users = this._filterInactiveUsers(users.toString());
if (!gs.nil(users))
return users;
}
}
var kbOwner = knowledgeGR.kb_knowledge_base.owner;
var kbManagers = knowledgeGR.kb_knowledge_base.kb_managers;
var approvers = '';
if (kbOwner.active) {
//Approval activity will handle any trailing comma, if there are no managers.
approvers = kbOwner + ",";
}
approvers = approvers + this._filterInactiveUsers(kbManagers);
return approvers;
thanks in advance,
snowman
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2024 10:52 PM
getApprovers: function(knowledgeGR) {
if (this.isVersioningInstalled() && gs.getProperty("glide.knowman.ownership_group.enabled", 'false') === 'true') {
var users = new KBOwnershipGr
if (gs.getProperty("glide.knowman.ownership_group.allow_self_approval", 'true') === 'false') {
var author = (knowledgeGR.revised_by && knowledgeGR.revised_by != '') ? knowledgeGR.getValue("revised_by") : knowledgeGR.getValue("author");
if (users.indexOf(author) !== -1) {
users.splice(users.indexOf(author), 1); // Remove author from the list if self-approval is not allowed
}
}
if (users.length > 0) {
users = this._filterInactiveUsers(users.toString()); // Filter out inactive users
if (!gs.nil(users)) {
return users; // Return the filtered list of ownership group members
}
}
}
var kbManagers = knowledgeGR.kb_knowledge_base.kb_managers;
return this._filterInactiveUsers(kbManagers);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2024 11:37 PM - edited 09-15-2024 11:53 PM
@Snow-Man check my above code..it will work for your case. Only last 2lines are enough and remaining should be removed from original script..for kbowner
Also override OOB script include to customize the logic
To override the initialize function in an OOTB script include, you can follow these steps:
Create a new script include that extends the OOTB script include.
In the new script include, define a function with the same name as the initialize function in the OOTB script include.
In the new function, add your custom code.
When you are finished, save the new script include.
When you use the new script include, your custom code will be executed instead of the initialize function in the OOTB script include.
Mark it as accepted as solution and helpful if it resolved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 05:22 AM
I hope all is sorted now 🙂