How to send notifications based on roles in knowledge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2022 10:12 PM
Hi All,
I have requirement in knowledge module that if the article is going to expire in 30days the notification should be sent to the author of the article. It is working fine but again if that author has knowledge role then only the notification should trigger fo for him, Otherwise it should not trigger.
Currently i am checking whether the author has Knowledge role or not by using gs.hasRole() in Advanced condition but it is not working as expected.
Code used in Advanced condition -
answer = true;
var aut = current.author;
var gr = new GlideUser().getUserByID(aut);
if(!gr.hasRole("knowledge")){
answer = false;
}
}
Can anyone please suggest how to do this as it is very urgent requirement.
- Labels:
-
Innovation of the Year
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 12:52 AM
Hello,
Could you please try below code -
if (gs.getUser().getUserByID(current.author).hasRole('knowledge')){
}
Please mark reply as Helpful/Correct, if applicable. Thanks!
Regards,
Akshay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2022 04:05 AM
Hi Akshay,
I have used the same code which you have given but still it is going for all members even though they don't have knowledge role.
Can you please suggest anything is missed
Thanks,
Deepa R