UI Builder Hide button based on role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2025 03:35 AM
Hi everyone Im trying to hide a button on the UI Builder based on a role, I have tried many things, the last one I trying was creating a "Data Ressource" "Check for user roles" and put the role there, and then on the button "Hide Component" I tried calling this data ressource using this code:
/**
* @Param {params} params
* @Param {api} params.api
* @Param {TransformApiHelpers} params.helpers
*/
function evaluateProperty({ api }) {
return !api.getData('userIsAdmin');
}
But it is not working, both users with the role and without the role can still see it, can anyone help with this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2025 03:49 AM
which button is that? is it an declarative form action? share some screenshots.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2025 05:53 AM