How to send notifications based on roles in knowledge

bhavana2
Mega Contributor

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.

2 REPLIES 2

Community Alums
Not applicable

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 

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