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

Thanks for the suggestions.

I still can't get the user details from gs object with session.established event. I am using Aspen: (02-22-2012_1816) release and I don't have Synchronous field.

event.parm1 gives me user name. Thanks!!.

I can run a business rule on Transaction Log table and check for "/login_redirect.do" in URL column. But not sure whether this will work in all situations.

I will also look into Installation Exits. But where can I find documentations on Packages (Packages.com.*) provided by Service-now? Is all java packages accessible in these scripts?

Thanks!!!


Not applicable


mujahid


the synchronous field isn't a customer-accessible field. This is a strong hint that you should not attempt to use it.

[quote]
I will also look into Installation Exits. But where can I find documentations on Packages (Packages.com.*) provided by Service-now? Is all java packages accessible in these scripts?
[/quote]

Our advice is don't use Packages. (I'm not sure how that follows from Installation Exits...?)


nikita_mironov
Kilo Guru

I have a Script Action (sysevent_script_action) that does something on user login. It looks as follows:

Name: action ame
Event name: session.established
Active: true
Synchronous: true
Condition: empty
Script:
usr = gs.getUserID();
....

It executes immediately user is in the system and accepts gs.getUserID(). The key element here is Event - session.established as ShaneBrazeal mentioned already.


Just to point out that 'synchronous' isn't a field you should be setting.

Standard configuration is that it is 'maint' only, i.e. not intended to be set on any customer records, or modified by customers.