Track when a user logins

Linda Kendrick
Kilo Guru

Created a new u_user_login table that wanting to track everytime a user logs in. I need to run reports to see how many times a person/dept is logging inot the instance.

I created a business rule on the new table with the following settings:
When:after
Insert:yes
Active:yes
Script
var gr = new GlideRecord("u_user_login");

if (current.operation() == 'login')
{
gr.sys_created_by = event.parm1;
gr.sys_created_on = event.parm2;
}

I used the default columns that were created with the table as I just need to track the user and the date.
I am not sure if I am using the current.operation correctly and I am not seeing a record getting inserted into the new table.

11 REPLIES 11

kedharnadhganga
Kilo Contributor

Hi All,



I need to capture user logins details with login timings, protocol and Ip address of the user. If the user logged in successfully or not must be reflect in next column after logging time and date,


is it feasible or not, can someone help me with with.


There's an event called login.failed and login.authorization.failed you may want to look into that or if you're using external authentication, there's an event name that starts with external.authentication.

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/single_sign_on/reference/r_EventQueueLoginActivities.html