Practical UIB Examples: Hide a container/component based on the user's role
Import
·
Jun 03, 2022
·
article
- Select the component or container that needs to have a dynamic visibility
- In the config panel, click the visibility icon
- Click on the script icon
- Set the visibility condition
/** * @param {params} params * @param {api} params.api * @param {TransformApiHelpers} params.helpers */ function evaluateProperty({api, helpers}) { let user_roles = api.context.session.user.roles; let visibility_condition = user_roles.includes("THE USER'S ROLE THAT SHOULD NOT SEE THE ELEMENT"); return visibility_condition; }
Labels:
View original source
https://www.servicenow.com/community/next-experience-articles/practical-uib-examples-hide-a-container-component-based-on-the/ta-p/2331910
