"can read" and "cannot read" related lists on KB articles

jayesh_hoondlan
Tera Contributor

how to setup "canRead" and "cannotRead" related lists on knowledge article in Istanbul, there is no OOTB related list for knowledge articles, thought present for knowledge base.

1 ACCEPTED SOLUTION

Hi Jayesh,



Thank you for sharing. I did not know about those fields. Very interesting.



To answer your question, the answer is no. Fields are fields, they appear on the form. Related lists are records in other tables that refer to the current record (either directly or via a many-to-many table.) They are two different things. Even if you were to create a related list with Can Read/Cannot Read and add User Criteria records, the logic isn't there in the platform to recognize and apply it to the current KB.



Can you help me understand what the motivation or value would be of having a related list of user criteria rather than list field on the KB?



Section 3.4 in this article may be helpful for understanding where the glide list fields and related lists are applied best.


http://wiki.servicenow.com/index.php?title=Modifying_the_Application_Design#Choose_the_Correct_Field...


View solution in original post

11 REPLIES 11

User criteria are evaluated at the knowledge base level, not at the article level. Therefore the Can Read/Cannot Read related lists are not available on each article.


Hi Chuck,



Thanks for the response,but found that from Istanbul version Can Read/Cannot Read option is available at article level too.But however the user criteria at Kb base overrides the user criteria at article level


I added the fields to the form as per Select user criteria for an article, but the fields do not show up. I do not see a UI policy or client script that would restrict visibility. Are these fields deprecated but the documentation is out of date?

 

find_real_file.png

Figured it out: Can Read and Cannot Read fields are only available for v3 KBs. I was testing on a v2 KB. The client script that controls this visibility is "Hide UC for V2 Article."

It is possible to implement a filter using a 'before query' business rule. If you're doing knowledge configuration in a scoped app you'll find the 'before query' business rule is not available. The rule must be created in the global space.

You'll need some indicator on the article to act as a filter, it could be possible to use the 'can/cannot read' fields but you'll need to figure out how to construct an encoded query in the business rule that translates to the same user criteria.

I decided to use a custom field added to the [kb_knowledge] table which maps to a group which is populated with the users who can read the article. Made the query much easier to construct since I didn't have to define an encoded query. Here's the content of the script I defined in the 'Advanced' tab of the rule.

 

(function executeRule(current, previous /*null when async*/) {

var user = gs.getUser();
if (user.isMemberOf('KB Tier 0 – Self Help')) {
current.addQuery('u_tier', "0");
}

})(current, previous);