Restrict Data Import to Group-Specific Records in Hardware table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello everyone,
We have a requirement to allow users to import data into the Hardware table (alm_hardware), with access restricted by a custom reference field u_managed_by_group (reference → sys_user_group). We have four distinct groups. Users should only be able to import records where u_managed_by_group matches their own group.
Example
- Hardware AC team members can import assets only when Managed by group = Hardware AC.
- Hardware DC team members must not be able to create/update records for Hardware AC, and vice versa.
By Using Data Sources we need to implement this, can someone suggest how to achieve requirement?
Any scripts needs to write?
@Ankur Bawiskar @Dr Atul G- LNG @Kieran Anson
Thanks,
Sattar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello @sattar3 ,
I will recommend use Transform map script,
In the Transform Map, add an onBefore script that checks if the u_managed_by_group on the incoming record matches one of the current user’s groups (gs.getUser().getMyGroups()). If not, set ignore = true so the record is skipped.
Script :
var userGroups = gs.getUser().getMyGroups();
if (source.u_managed_by_group && userGroups.indexOf(source.u_managed_by_group) == -1) {
ignore = true;
gs.addInfoMessage("You are not allowed to import records for group: " + source.u_managed_by_group);
}
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
how are they importing?
share the screenshot
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader

