Business Rules for the User Sessions[ sys_user_session ] table are not executed.

Ariyama Nanase
Tera Expert

I want to create a Business Rule that removes a role when a user's session times out.


I have created a Business Rule as follows, but the Business Rule does not execute when the user's session times out.
However, if I manually enter a value in the “Invalidated” column of the User Sessions[ sys_user_session ] table, the business rule executes.

 

Why are business rules not automatically executed when a user's session times out?

 

<Setting Business Rules>

Table: User Sessions[sys_user_session]
【When to run】
 When:after
 Filter Conditions:Name is not empty
 Update
【Advanced】
 Script : The “ invalid” column of the sys_user_session table identifies the username to which the update has been applied and contains a script to remove the role of that user.

 

If anyone has any idea of the cause, please let us know.

Thank you.

 

1 ACCEPTED SOLUTION

Ariyama Nanase
Tera Expert

I was able to do this by setting the table for the Business Rule to be the user login history [sys_user_login_history] table instead of the user session [sys_user_session] table.

Thank you for your help!

View solution in original post

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

There are some tables where you can't run Business Rules on. If this also applies to this table, honestly don't know!

 

What you could think of as alternative, have a look if there are events generated. And use those events to run your logic.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof 

When you say "there are some tables where you can't run Business rules", what does that exactly mean?
You can't create a custom one, or the BR itself is not supported there. Are there any examples of such tables which you can share?

 

Best Regards
Aman Kumar

I have inquired with NowSupport and they say that the user session [sys_user_session] table is the table where Business Rules can be executed.

 

Also, there were no events kicked when a session times out.
The “login” and “logout” events are kicked when a user logs in and logs out.

 

Do you see any reason why the business rules are not being executed?
Please let us know if you have an alternative solution.

Ariyama Nanase
Tera Expert

I was able to do this by setting the table for the Business Rule to be the user login history [sys_user_login_history] table instead of the user session [sys_user_session] table.

Thank you for your help!