What does "current.user.nil()" mean here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2013 08:14 AM
In this wiki topic: http://wiki.servicenow.com/index.php?title=Creating_New_Homepages it talks about updating "Edit Homepage" UI action with condition:
gs.hasRole('admin') && current.user.nil()
What does "current.user.nil()" mean here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2013 08:20 AM
Means the "user" field has no value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2013 08:25 AM
I believe this is meant to prevent the UI Action from appearing if the page is some individual's personalized homepage. Thus, only global homepages will have the button.
Personalized homepages probably have a reference to the owner in the "current.user" field, so "current.user.nil()" tests to make sure it doesn't have a value.