- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:01 AM
Hello Guys .....Can you please guide with the following requirement.
1) I have a form with with only two date fields.
2) I want to create ACL to update the entries depending on the users who creaetd it .
3)
The following sript condition is not working.
4) please guide me ,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:21 AM
Hi Naresh,
You can use the below script as sys_created_by stores the user_name of the user.
if(current.sys_created_by.equals(gs.getUserName())
return true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:17 AM
FYI, gs.getUserID() returns the sys_id of the logged in user.
And the comparison will never be true as you're comparing the sys_id with the email id of the user.
You should be able to check it with - answer = (gs.getUserID() == current.opened_by);
OR, if opened by is not present then you can glide the user table -
var usr = new GlideRecord('sys_user');
usr.addQuery('user_name',current.sys_created_by);
usr.query();
if(usr.next())
{
answer = (usr.sys_id == gs.getUserID());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:21 AM
Hi Naresh,
You can use the below script as sys_created_by stores the user_name of the user.
if(current.sys_created_by.equals(gs.getUserName())
return true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:23 AM
sys_created_by is returning UserID so can userID and UserName be same.
I have not tried it . let me try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:25 AM
User ID is the label name and the column name is user_name in the User table. Yes, please try and let me know, if it works.