How to get browser information on user login?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2018 01:10 AM
We created a custom table to log every time a user logins, we get the information from sysevent and event name is login. Is there anyway we can add browser information to this?
Data is populated via script action on event "login"
var userLogin = new GlideRecord("u_user_login");
userLogin.u_user_name = event.parm1;
userLogin.u_user = event.user_id;
userLogin.u_when = event.sys_created_on;
userLogin.u_ip = event.parm2;
userLogin.u_event = event.name;
userLogin.insert();
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2018 01:35 AM
There is a way to get the Browser details from a user sessions.
We use the below sessions.
gs.getSession().getProperty('user_agent_browser'); // For browser
gs.getSession().getProperty('user_agent_version'); // for browser version

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2018 01:59 AM
This didn't work. The data on custom table is from the sys_event table and is populated using below script action (we added the line you suggested and it didn't have any value perhaps because the system run the insert to the custom table)
var userLogin = new GlideRecord("u_user_login");
userLogin.u_user_name = event.parm1;
userLogin.u_user = event.user_id;
userLogin.u_when = event.sys_created_on;
userLogin.u_ip = event.parm2;
userLogin.u_event = event.name;
userLogin.u_browser = gs.getSession().getProperty('user_agent_browser'); // for browser version
userLogin.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2018 03:02 AM
This is what i did, created a new field in sysevent table and labeled it as browser and added the following default value.
javascript:gs.getSession().getProperty('user_agent_browser')
Post this i logged in using IE and chrome and it captured the browser detail.
Hope this helps.
If this resolves your issue, mark the answer correct and close this thread

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2018 03:42 AM
Is there a way to get the full user agent string? I saw somewhere in the community that navigator.userAgent returns the full user agent but I tried using javascript:navigator.userAgent as default value but nothing happens.