- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2021 11:00 AM
Hello,
I have a new field I have created on the user table. This field will only be able to be written to by Admins and through a record producer we have on our portal (record producer does not create record, it does update). I need an ACL that only allows Admin to write too. I have a custom role that will only have read access. If a user is trying to update their record from the back-end on the user table, they should also have access.
Currently, I have everything setup. I have a write ACL for Admin only, so no other users can make modifications. Now I need to add something that will allow current users to make modifications to their own records.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2021 11:13 AM
You can add following code in acl script
if (!gs.hasRole('admin')&& gs.getUserID() !== current.getValue('some user field on record')) {
answer = false;
} else {
answer = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 09:29 AM
@mkader, I tried with below script but it is not working, so could you please assist me on this.
Regards,
Ashok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2024 09:38 AM
@Pranesh072 , I tried with below script but it is not working could you please assist on this.
Regards,
Ashok.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 02:57 AM
@Ashok59 owned_by is reference field. gs.getUserName will return the user_id of the user.
you can use
gs.getUserID() == current.getValue('owned_by')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2021 11:22 AM
You could try something like this; create an ACL with this condition:
Created By is javascript:gs.getUserName()
Edited: I had getUserID but it should be getUserName for created by.
I hope this helps!
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2022 08:48 AM
Only a professionals in ICT can give a good answer on this topic. Thank you for sharing solutions how to write a user access. I'm a new student at Computer Science and all this things seem to me pretty difficult. But I'm glad I can be a part of ServiceNow community and follow professionals. It's the same as I follow a reliable writing service edubirdie on https://edubirdie.org/ because they have writers in different niches. Already two times they saved me from a failure with research work on servers (I have to admit I'm not so good at it at this moment). Gonna to read more topics here.