Relationship between cell context menu UI actions and "Requires role"

bonsai
Mega Sage

I want the UI actions displayed in the cell context menu to be visible only to admins.

I set the "Requires role" for the UI action to admin, but it was not hidden.
Is this not possible to use this on the list screen?

2 ACCEPTED SOLUTIONS

@bonsai 

then don't touch the OOTB UI action

Ensure you override that for your custom table

1) open the OOTB one

2) change the table to your custom table

3) add this in condition

current.canWrite() && gs.hasRole('admin')

4) Right click form header and "Insert and Stay"

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

Hey @bonsai , You can try the method suggested by @Ankur Bawiskar .

When I was trying to recreate this in my PDI, I used the 'UI Action Visibility' option from the related lists. I added 'Admin View' to the list, and that helped hide the UI Action to other non-admin users. You might want to try that too, if it works for what you need.

View solution in original post

11 REPLIES 11

Actually, I had already tried this, but it didn't work.

The product documentation said that "current" cannot be used on the list screen.

Could this be the cause of the problem?

@bonsai 

On which table you are checking this?

May be that table which is task extended has created it's own "Assign to me" List Context Menu button and you need to add gs.hasRole('admin') in that

list context menu can access current object

that OOTB UI action does set assigned_to using current object

AnkurBawiskar_0-1745491200904.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Testing with a custom table that extends the task!

@bonsai 

then don't touch the OOTB UI action

Ensure you override that for your custom table

1) open the OOTB one

2) change the table to your custom table

3) add this in condition

current.canWrite() && gs.hasRole('admin')

4) Right click form header and "Insert and Stay"

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @bonsai , which task are you trying to test with? - incident, problem, - like that?