Hello Folks,
I have a requirement to display last login time for any user whenever they login to the application. As we know, it's a site page, where-in a user lands whenever they login, and a process can be triggered only with user interaction.
Is there any way to implement this?
Any suggestion/help is highly appreciated. Thanks in advance!
Thanks Shobhit.
Discussion posts and replies are publicly visible
As in display the current time on the form they land on? Couldn't you just show them the current time in that case? If not, how does what you're thinking of differ from simply showing the current time on their landing page?
Apart from that, it's always possible to scrape the login-audit.csv file for recent logins, pretty easily. You could probably develop an expression rule that consumes a username, does its log file reading / data processing in the background, then returns the last login-audit timestamp.
Just for an example, if you put the following into an expression rule (with a single text rule input called "username"), it should return the timestamp of the user's latest login time (if any).
a!localVariables( local!auditRead: readcsvlogpagingwithheaders( csvPath: "login-audit.csv", startIndex: 1, batchSize: 100, headers: {"timestamp", "username", "success", "ip", "mode", "agent", "uuid", "something else"}, filterColumName: "username", filterOperator: "=", filterValue: ri!username ), local!length: if( local!auditRead.totalCount > 0, length(local!auditRead.rows), null() ), local!rowValues: if( local!auditRead.totalCount > 0, a!forEach( local!auditRead.rows, split(fv!item, ",") ), null() ), local!date: index( index( local!rowValues, local!length, null() ), 1, null() ), if( a!isNotNullOrEmpty(local!date), local(gmt(parsedate(local!date))), null() ) )