How to visible UI Action button only for the user who is member of watchlist field.

VIKAS MISHRA
Tera Contributor

I Have one UI action on the incident form and i want to visible that button only to those user who is the mentioned in the watchlist field.

Just to highlight that in watchlist field user name and email id both can be added and that email id can be of one group of servicenow that means all the members of that group should also be able to see that button

 

VIKASMISHRA_0-1676472573295.png

 

3 REPLIES 3

SatyakiBose
Mega Sage

Hello @VIKAS MISHRA 

Please refer to this community link on how to add the UI action condition

https://www.servicenow.com/community/now-platform-forum/ui-action-visibility-to-watch-list-field-use...

 

The condition should be of type : 

current.TABLE_NAME.WATCH_LISTFIELD_NAME.toString().indexOf(gs.getUserID()) > -1

-Andrew-
Kilo Sage

Hi there,

In the UI Action condition add this:

current.kb_knowledge_base.WATCH_LISTFIELD_NAME.toString().indexOf(gs.getUserID()) > -1

OlaN
Giga Sage
Giga Sage

Hi,

You can set the condition on the UI action so that it's only visible if the currently logged in user is on the list.

 

This should work for the part where a specific user is set in the watchlist:

 

!current.watch_list.nil() && (current.watch_list.toString().indexOf(gs.getUserID()) >= 0)

 

To solve the second part with mail-address in the watchlist, is a bit more complicated, and I can't think of a solution right now.

I'll give it some thought and get back later on that one.