User Criteria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 02:37 AM
Hello ,
I have user criteria set for knowledge articles .
for example if german users than in script it checks if the users preferred language is german than it shows the article .
Now the problem is say suppose their is a user Abel Tutor whose preferred language is English . Their is one article KB0015321 which has can read set to all german users . Now though abel tutor is owner of article but still he is not able to view it as his preferred language is english . How do I modify my script ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 03:17 AM - edited 12-03-2024 03:18 AM
How to dynamically set the addQuery()? Below is my script
(function checkLanguage() {
var userGR = new GlideRecord('sys_user');
if (userGR.preferred_language == 'de') {
return true;
}
return false;
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 04:23 AM
Hello @harry24
You Can try this logic:
- Add a condition to check if the user is the author of current knowledge article
// Get the current user
var userSysId = gs.getUserID();
var user = gs.getUser();
// Check if the user is the author of the article
if (current.author == userSysId) {
// Author can always view the article
return true;
}
- If Yes it returns true bypassing the user criteria check.
- If No then add the existing user criteria logic
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 04:32 AM
this is not working