The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Knowledge-what/where defines who can retire an article?

matthew_magee1
Giga Guru

Racking my brain trying to figure out where the properties are set for knowledge that defines who can retire articles.

I understand the UI Action calls a script include but that doesn't give me much to go on. I was hoping the DOCS site would give some indication who can retire knowledge articles. So far I've narrowed it down to:

Knowledge Base Manager

Article-Last Updated By

Any help is greatly appreciated

1 ACCEPTED SOLUTION

matthew_magee1
Giga Guru

UI Action:

Retire Condition:

!(new KBCommon().isStackNameDialog()) && (new KBKnowledge().canRetire(current))

This relies on a couple of Script Includes, the first isn't all that important for our purposes. The canRetire calls the KBKnowledge Script Include which in turn calls the KBKnowledgeSNC Script Include which calls KBCommonSNC.

Here is the actual code that determines if you can see the retire button:

canRetireKnowledge: function(itemGr){

// Case 1: Pass in a valid value if (!itemGr)

return false;

// Case 2:If the record is published continue

if (itemGr.workflow_state != "published" && itemGr.workflow_state != "draft")

return false;

// Case 3: If user can contribute continue

if (!new SNC.KnowledgeHelper().canContribute(itemGr))

return false;

// Default: Allow user to retire knowledge

return true; },

UI Action:

Delete Condition: !(new KBCommon().isStackNameDialog()) && current.isValidRecord() && current.canDelete()

This is a little easier in that you have a couple of standard functions: isValidRecord() and canDelete(). Here is a quick script that I wrote to be able to determine the state of these 2 values for a given KB Article:

var current = new GlideRecord("kb_knowledge");

current.get("sys_id", "<sys id of kb article>");

gs.log(current.isValidRecord());

gs.log(current.canDelete());

Both of these are going to rely on the way the user is defined.

For the Retire it will depend on:

  1. Where the article is in its lifecycle
  2. If the user is a contributor for the given KnowledgeBase.

The delete is going to rely on the ACL's associated with the kb_knowledge table.

View solution in original post

6 REPLIES 6

matthew_magee1
Giga Guru

UI Action:

Retire Condition:

!(new KBCommon().isStackNameDialog()) && (new KBKnowledge().canRetire(current))

This relies on a couple of Script Includes, the first isn't all that important for our purposes. The canRetire calls the KBKnowledge Script Include which in turn calls the KBKnowledgeSNC Script Include which calls KBCommonSNC.

Here is the actual code that determines if you can see the retire button:

canRetireKnowledge: function(itemGr){

// Case 1: Pass in a valid value if (!itemGr)

return false;

// Case 2:If the record is published continue

if (itemGr.workflow_state != "published" && itemGr.workflow_state != "draft")

return false;

// Case 3: If user can contribute continue

if (!new SNC.KnowledgeHelper().canContribute(itemGr))

return false;

// Default: Allow user to retire knowledge

return true; },

UI Action:

Delete Condition: !(new KBCommon().isStackNameDialog()) && current.isValidRecord() && current.canDelete()

This is a little easier in that you have a couple of standard functions: isValidRecord() and canDelete(). Here is a quick script that I wrote to be able to determine the state of these 2 values for a given KB Article:

var current = new GlideRecord("kb_knowledge");

current.get("sys_id", "<sys id of kb article>");

gs.log(current.isValidRecord());

gs.log(current.canDelete());

Both of these are going to rely on the way the user is defined.

For the Retire it will depend on:

  1. Where the article is in its lifecycle
  2. If the user is a contributor for the given KnowledgeBase.

The delete is going to rely on the ACL's associated with the kb_knowledge table.

Hi,

So OOB ITIL is a contributor in that they can at least draft an article and "publish" to the next person...who I believe would be the KB owner/manager and they would ultimately "publish" it for real...so if the retirement ability rests on the stage the article is in...in its lifecycle AND....if the user is a contributor...then wouldn't ITIL be able to retire as well?


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!