How to hide attachment in vendor management workspace for two assignment groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
How to hide attachment in vendor management workspace for two assignment groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @skaramsetty,
This one comes up a lot because Vendor Management Workspace is built on UI Builder (the Next Experience framework), and the Attachment component there doesn't ship with a native "hide for this assignment group" toggle the way you might expect. You're really dealing with two separate layers here: what's visible on the page, and what's actually allowed at the table level, and it's worth being clear on which one you need before you build anything.
A few things to check and set up on your instance:
- UI Builder visibility condition: every component and container in UI Builder has a visibility option in the config panel with a script editor, using an evaluateProperty function that can read api.context.session.user.roles. That works cleanly for roles, but the api object doesn't expose group membership directly, so a plain role check won't get you to "these two assignment groups" on its own.
- Group check needs a server hop: since there's no client-side group property to read, add a server script Data Resource (or a small Script Include called via GlideAjax) that runs gs.getUser().isMemberOf() against each of your two group sys_ids, bind the boolean result to page state, and reference that state variable in the Attachment component's visibility condition instead of trying to script the group lookup inline.
- sys_attachment ACL: hiding the component only removes it visually. Anyone with a direct attachment URL, API access, or the classic UI can still reach the files, so if this is a real access control requirement and not just a UX cleanup, you also need a read ACL on sys_attachment that denies access when the parent record's assignment_group matches one of the two groups, unless the user has an override role.
- Test with impersonation: log in as, or impersonate, a member of each of the two groups and confirm both the component and a direct attachment link respect the restriction, not just the workspace happy path.
If this is purely cosmetic, the visibility condition alone gets you there and is the faster build. If you actually need to stop those two groups from pulling the files, don't skip the ACL, that's the only layer that's genuinely enforced server-side rather than just hidden in the UI.
References
- Practical UIB Examples: Hide a container/component based on the user's role
- UI Builder Essentials: Using the Attachment Component
- GlideUser API reference
- Hide Attachments based on Assignment Group
Thank you,
Vikram Karety
Octigo Solutions INC