Business Rule on user login

mujahid2
Kilo Contributor

Hello,

I am trying to write a business rule which runs during the user Login.
Currently I am using a before insert on v_user_session table.
Inside business rule I am querying the v_user_session again to check if user is already logged in(which is not insert or update just selection). Because of this query, this business rule runs into an infinite loop leading to an error.
Can any anyone help me on how to run a business rule during user login.

Thanks in Advance!!

8 REPLIES 8

ShaneBrazeal
Tera Contributor

If you are trying to run a server side script when the user logs in, you might want to check out a script action (http://wiki.service-now.com/index.php?title=Script_Actions) and set it to run on the session.established event.


Thanks for the suggestion.

Can I use GlideSystem object in Script Actions. When I use gs.getUserID() and gs.getUserName() it returns the string "system". I also need to use gs.eventQueue() method.
I also tried to use GlideDateTime object's getLocalTime() and getLocalDate() functions but it gives me the GMT time and date.

Thanks


Not applicable

Events generally are processed in their own context, usually as 'system', not the user's.

Depending upon what you want to run at user login time, Installation Exits might be what you're looking for.
http://wiki.service-now.com/index.php?title=Installation_Exits


You also have access to


event.parm1
which is the username of the user logging in.