query business rule based on knowledge article can read user criteria
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2024 01:27 PM
I have a scenario where I need to write query business rule to display knowledge article only to the users who is users of can read user criteria in article only then he should be able to read it and not using ACL
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 12:39 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 01:18 AM
Hi @selva kumar1 You need to glideRecord a "user_criteria" table in query BR. Refer below script and modify accordingly
(function executeRule(current, previous /*null when async*/) {
var userCriteria = new GlideRecord('user_criteria');
userCriteria.get(current.can_read_user_criteria);
if (userCriteria.isValidRecord()) {
var userCanRead = userCriteria.isUserInCriteria(gs.getUserID());
if (!userCanRead) {
current.setAbortAction(true);
gs.addErrorMessage('You do not have permission to read this article.');
}
}
})(current, previous);