Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Display UI action button based on role

chanikya
Kilo Sage

Here we have "Republish " button, it should be visible only   ---who are having " kb_retire" role     OR     who are the author in KB article.                                                                                                                                                             My condition is not working.....

if you see below image i am not a Author of this article and i don't have kb_retire   role, but it is visible me

it should be visible only=-------who are having " kb_retire" role         OR             who are the author in KB article.  

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

can you try now




gs.getUser().getRoles().indexOf('kb_retire') >= 0 || current.author==gs.getUserID() ||   !(gs.getUser().getRoles().indexOf('admin') >= 0 )  


View solution in original post

32 REPLIES 32

Hi,



Admin will be able to see that. Try impersonating other user and check.



Thanks


Can we restrict   " republish" button to admin   role   users and     it should be visible   to only Kb_retire role users and how are Author of this KB record .


put one more condition as



!gs.hasRole('admin')



Try



Thanks


Ashutosh


not working...




find_real_file.png





find_real_file.png