Business Rule on user login
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2012 01:55 AM
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!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2012 05:15 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2012 09:39 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2012 06:42 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2012 07:50 AM
You also have access to
which is the username of the user logging in.
event.parm1