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

Ankur Bawiskar
Tera Patron
Tera Patron

@bonsai 

which UI action are you referring to?

give some screenshots.

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

GopikaP
Mega Sage

Hi @bonsai , 'Requires role' should function as expected. Please check if there are any duplicate UI Actions—it's possible that another UI Action with the same name exists, and the role was assigned to that one instead.

If not, please share the UI Action name.

bonsai
Mega Sage

This is the OOTB "Assign to me".
It's from the Task table.

I verified it again with PDI and it worked fine, but for some reason in the company's instance it was displayed even without a role.

There are no other similar UI actions.

There are no errors, so I think it may be a bug.

 

Assign to me.JPG

@bonsai 

if you want only admins to see then use condition as this

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

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