Skip to main content
November 28, 2023
Question

getlastlogindatetime

  • November 28, 2023
  • 4 replies
  • 0 views

Hi All

I am using getLastLoginDateTime function which is in the below plugin

 [mention:f77937a217d845edaa4c53ff358f0f09:f7d226abd59f475c9d224a79e3f0ec07] 

But facing weird issue. 

below are the code snippet

It is working fine without typecase but while typecast it is showing error
Note :- loginDateTime has date and time data type and it is not working for 2-3 users and for rest it is working fine even while typecast.

4 replies

silambarar921604
Participating Frequently
November 28, 2023

Yogesh, 

From your screenshots, it seems like the function is returning the text string and your loginDate field in the CDT is expecting the data and time. Can you please make sure the resultant of your expression be date and time? Let's say convert the resultant to date and time and try the same?

November 28, 2023

Problem is with what getlastlogindatetime() function is returning. Its returning time in 24 hour format but for some reason, it is appending AM/PM after each result as 24 hour time format is represented without AM/PM.

That's why it couldn't be converted to datetime. So, it will throw error if user's login time is at or after 1 pm. One solution would be to convert 24 hour time to 12 hour.

mikes0011
Brainy
November 28, 2023

I'd suggest reporting this as a bug to the plugin's author.  In the meantime, something I've done myself in the past to fix a "wonky" datetime value returned by a plug-in like this, was to build a custom expression rule that can consume the incorrect text value and parse it to return the correct dateTime value - it's a lot easier to test that way.

The Expression Guru