- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 07:08 AM
Is there an existing method, property or widget that shows a user their last logged on time when they first log in?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 12:55 PM
Hey Michael - got it.. That would actually be a cool widget 🙂
I'm not aware of something that already exists to show the interactively logged on user this data when they login.
Might want to look at a report that you can stick onto a Homepage or Dashboard.
- Would need to do some testing and ACL permission checking but potentially could create a report like:
- Table = [sys_user]
- Condition = [sys_id = javascript:gs.getUserID();]
I suspect folks in the Platform Community may have a more elegant solution that this, but it's a starting point to investigate...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 10:18 AM
Hey Michael - you can spot this information on the <sys_user> table, there is a field on 'Last login time'.
Noticing that you posted this in the Security Operations (SecOps) Community - this question might be more appropriate for the Platform Community. The SecOps Community is more tailored to the SecOps suite of ServiceNow Applications.
Reference:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 12:24 PM
Thanks. I'll take this to the Platform community. I did see that field in the data. I'm just trying to get that information to be available as the user logs in.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 12:55 PM
Hey Michael - got it.. That would actually be a cool widget 🙂
I'm not aware of something that already exists to show the interactively logged on user this data when they login.
Might want to look at a report that you can stick onto a Homepage or Dashboard.
- Would need to do some testing and ACL permission checking but potentially could create a report like:
- Table = [sys_user]
- Condition = [sys_id = javascript:gs.getUserID();]
I suspect folks in the Platform Community may have a more elegant solution that this, but it's a starting point to investigate...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 04:27 PM
Hi Michael,
Keep in mind that the Last Login Time field is only updated when you log. Not when you connect.
If you logged for the first time a month ago, then connected every few day without having to re-enter your password, because your browser session was still valid, then the Last login time would be last month.
This is the last time you had to enter your password.
It could potentially lower the value of such a security welcome banner.
If this is still valuable to you, then I would create an advanced business rule (on update) for the sys_user table, triggered each time the last login time is updated.
The script would then contain something like:
If (previous.last_login_date)
gs.addInfoMessage(“Welcome “ + gs.getCurrentUser().getDisplayValue() + “, your last login was on “ + previous.last_login_date.getDisplayValue());
(Script not tested, as I’m writing from my mobile phone, but I can complete it if required)
That would ensure that the security banner is displayed after every login, regardless of the page opened.
∴
Best regards from Switzerland
Shiva :¬,
If this reply assisted you, please consider marking it 👍Helpful or ✅Correct.
This enables other customers to learn from your thread.