- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 04:43 AM
I am having issue in ACL.
I want a checkbox field in user table to be edited only by the user who's profile it is. Nobody else has the right to edit that field. For eg. I can make check/uncheck that field in my user profile. Nobody else can do.
I have written a script but that is not working. Can anybody help me on that.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 05:49 AM
Hi Sri,
you are comparing user_name with current.sys_id in below line
us.addQuery('user_name', current.sys_id);
This won't work since current.sys_id will give you sys_id and user_name field in user table has user name
use this
gs.getUserName()in place of current_sys_id.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 04:47 AM
Hi Sri,
Can you create a field level write acl for that field with condition as only logged in user can edit that.
Give operation as write,
In the Name drop down select your table, besides that you can select your field.
Then click advance and in script section determine whether user has that profile and set answer = true if you want to make it editable and answer as false if not editable
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 04:55 AM
Yes i have selected that only,
Here's my script :
var us = new GlideRecord('sys_user');
var userN = '';
us.addQuery('user_name', current.sys_id);
us.query();
if (us.next()){
userN = us.getValue('sys_id');
}
if(userN == current.sys_id)
answer = true;
else
answer = false;
But this is not allowing the user to edit even his user profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 05:49 AM
Hi Sri,
you are comparing user_name with current.sys_id in below line
us.addQuery('user_name', current.sys_id);
This won't work since current.sys_id will give you sys_id and user_name field in user table has user name
use this
gs.getUserName()in place of current_sys_id.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2021 02:01 AM
Hope you are doing good.
Did my reply answer your question?
If so, please mark it correct so that the question will appear as resolved for others who may have a similar question in the future.
Thanks!
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader