Solved

Use session log information in application

  • 17 July 2023
  • 3 replies
  • 54 views

Badge

Good morning,

In IAM, you can see when your users logged in etc. in the session log information. Is there a way to extract information from the session log and show this in the end application? We would like to be able to show the datetime of the last login of a user in our application.

icon

Best answer by Harm Horstman 17 July 2023, 10:37

View original

This topic has been closed for comments

3 replies

Userlevel 5
Badge +20

Hi Stefan,

We are using a startup procedure that maintains a record in a table for each end user for this. The name of the procedure is defined as Extended Property (StartupProcedure)


The procedure should contains something like this:

​​​​​​​IF NOT EXISTS (SELECT 1 FROM tw_user WHERE usr_name = dbo.tsf_user())
  BEGIN
     
     INSERT INTO tw_user (
         usr_name
       , is_active
       , last_login_date_time
       , insert_user
       , insert_date_time
     )
     SELECT usr_name              = dbo.tsf_user()
          , is_active             = 1
          , last_login_date_time  = GETDATE()
          , insert_user           = dbo.tsf_user()
          , insert_date_time      = GETDATE()
  END
ELSE
  BEGIN
    UPDATE tw_user
    SET    last_login_date_time = GETDATE()
         , is_active             = 1
         , update_user          = dbo.tsf_user()
         , update_date_time     = GETDATE()
    WHERE  usr_name = dbo.tsf_user()
  END

 

Userlevel 7
Badge +23

Hi Stefan,

Harm's suggestion is great for Windows and Web GUI 😄 In case you would like this to show up in the Universal GUI, you can make use of Start objects for the application. You can start a Process flow or run a Task for example to execute Harm's procedure. Additionally, you could add an Open document process action to the process flow open a certain screen if desired. 

Badge

Thank you both, this worked perfectly! :)