- 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:20 AM
Hi Naresh,
The condition will never return true as:
gs.getUserID will return in form of sys_id . Ex.33fe5245c331210038bf506adfba8fcc
current.sys_created_by will return string. Ex. Naresh Chandurkar.
You should be using following condition if you want to check the validity of current user.
gs.getUserName() = current.sys_created_by;
Let me know if you still have issues.
Cheers,
Hardit Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:36 AM
Nope Not working.
My Question to you .
1) what does sys_created_by return what --> userID or user Name.
2) UserName returns what --> UserID /User NAme
My Observations
sys_careated_by-->returning userID
uer_name returns-->name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 12:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 01:01 AM
Hi Naresh,
The field User ID is having the label as User ID and column name as user_name
Which means both are one and the same
You can see by configure dictionary
Where as the function gs.getUserID() will return the sys_id of the currently logged in user
gs.getUserName() funcation will return the user_name which is the User ID field of the sys_user table
Check this link
getUserID() | Returns the sys_id of the current user. |
getUserName() | Returns the username of the current user (for example, jsmith). |
http://wiki.servicenow.com/index.php?title=GlideSystem#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 01:14 AM