- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 11:35 AM
How do I set the read ACL on a table to only allow users to read records that they have created? I have been trying to add the following conditions without luck
Created By is javascript.gs.getUserName() OR Created By is empty
I am working in the Geneva instance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 11:59 AM
I THOUGHT SO!!! t! It's not in the wiki, it's on the developer API site.
Best practice is to use conditions before scripts, so...
Created by | is | javascript:gs.getUserName()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 11:52 AM
We're all wrong! Abhinay is right in that it's a string, not a sys_id.
It's the user's login name, not their email. gs.getUser() doesn't have a method to return the user_name field.
You'd have to write your own little script include:
Name: getMyUserName
function getMyUserName() {
var u = new GlideRecord('sys_user');
if (u.get(gs.getUserID())
return u.user_name;
return;
}
and call it with
Created By | is | javascript:getMyUserName()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 11:56 AM
Hi Chuck,
I think it's not required as we already have OOTB one gs.getUserName()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 11:59 AM
I THOUGHT SO!!! t! It's not in the wiki, it's on the developer API site.
Best practice is to use conditions before scripts, so...
Created by | is | javascript:gs.getUserName()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 12:01 PM
I believe it is there on the wiki too.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2016 12:01 PM