Workspace records view restriction based on group members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2025 06:54 AM
we want to show the my asset records depends on support group users in workspace , any idea how to achieve this?
- Labels:
-
Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2025 07:23 AM
Yes, you can achieve this in ServiceNow Workspace by applying dynamic filters and data policies to control which asset records a user sees, based on their Support Group membership.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2025 08:23 AM
Can you elaborate where I can apply thats needs to fucntion on workspace . Data polices normally works on form level, how to do in workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2025 09:27 AM
I found a it in UI builder to set data policy but can we do modify OOTB workspace ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2025 11:41 AM
Hi @sukran
- Asset Table:This table stores your asset information (e.g., alm_hardware or cmdb_ci_asset).
- Support Group Field:This field in the asset table links the asset to a specific support group (e.g., a reference field pointing to the sys_user_group table).
- User Group Membership:Determine how users are assigned to support groups (e.g., through the sys_user_grmember table).
- Create a script include to encapsulate the logic for retrieving the user's support group(s).
- This script should:
- Get the currently logged-in user's ID (gs.getUserID()).
- Query the sys_user_grmember table to find the user's group memberships.
- Return an array of group IDs.
- Select the Asset Table:In UI Builder, specify the asset table as the data source for your workspace page.
- Add a List Filter:
- Add a list filter to the UI Builder component that displays the asset records.
- Use the sys_user_grmember table to query the groups the user belongs to.
- Use the script include (if you created one) to dynamically retrieve the group IDs.
- Filter the asset records based on the support group field, ensuring that only assets assigned to the user's support groups are displayed.
var MyAssetFilter = {
getSupportGroups: function() {
var user = gs.getUserID();
var userGroups = new GlideRecord('sys_user_grmember');
userGroups.addQuery('user', user);
userGroups.query();
var groupIDs = [];
while (userGroups.next()) {
groupIDs.push(userGroups.getRefRecord('group').getUniqueValue());
}
return groupIDs;
}
};
// Assuming you have a field named 'support_group' in your asset table
// and a script include named 'MyAssetFilter'
// and a UI Builder component that displays the asset records
var supportGroups = MyAssetFilter.getSupportGroups();
// Filter the records based on the 'support_group' field
var query = "support_group IN " + supportGroups.join(",");