Restricting Hardware table data visibility based on location
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 01:57 AM
Hi!
I'm trying to restrict my Hardware table data (alm_hardware), based on the logged in user's location.
For example:
Say Hardware A, B and C; Location 1 and 2; User x and y;
Hardware A and B is in Location 1; Hardware C is in Location 2;
User x is in location 1, user y is in location 2
If user x login into ServiceNow portal they should only see the Hardware Asset details of A and B in the alm_hardware.
If user y login into ServiceNow portal they should only see the Hardware Asset details of C in the alm_hardware.
How do I achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 02:09 AM
Hello @FlaviaRoshni
You need to create a Read ACL on the Hardware Table :-
var gr = new GlideRecord('sys_user');
var user = gs.getUserID();
gr.get(user);
gr.query();
if(gr.next()){
if(gr.location == current.location){
answer=true;
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 08:52 AM
Thank you! The solution helped!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2023 01:32 PM
Hello @FlaviaRoshni
As my response helped you, plz mark it accepted solution. It will help future members.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 06:48 AM
Hello @FlaviaRoshni
If you find my response helpful, Please mark it as Accepted. it will help the future users to reach your post.
Regards,
Samaksh