Restrict records based on user who manages the PC/Laptop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 09:55 AM - edited 08-01-2023 10:09 AM
HI,
There is a requirement for the users who is managing the PC/Laptops for their location should create/edit the records in computer table.
Lets assume User ABC is part of Australia location and he manages 100 devices, User XYZ is a part of India location, he manages 50 devices.Here user ABC should not create/edit records for India locations and user XYZ should not create/edit records in Australia location.
I have created three ACL's Create/Read/Write for computer table and written the below script, which is not working
I have enabled the log in script, i am able to get the loggedin user but its not allowing to write/read the records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 12:38 PM
@Rajamouly Replace below line of code
var user = gs.getUserDisplayName();
with
var user = gs.getUserID();
Managed by field on CMDB is a reference field so we need to compare it with sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 01:21 AM
Thanks for your response.
I have already used gs.getUSerID(), its giving sys_id, But still the user not able to see the records. Am i doing anything wrong here?