function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Adarsh G 6Adarsh G 6 

Copy last login date to custom field on login

Hi,
When the user logs in his lastlogin date will be automatically updated. Is there  a config way to copy the last login date to a new custom field on login just before the last login date is updated to today's value?

i want Previous last login date in a custom field. Is there a way to achieve this without trigger?

Thanks
ANUTEJANUTEJ (Salesforce Developers) 
Hi Adarsh,

The only way I was able to find is to use a trigger and it is in below link:

>> https://salesforce.stackexchange.com/questions/43812/how-do-i-populate-the-last-login-date-from-user-object-into-a-custom-object-fiel

However, there is also an idea wherein it is regarding the access to the last login field on user object in the formula field I think this idea works perfectly in regards to your scenario. You can upvote it so that if it reaches the necessary threshold it may be considered in the future.

>> https://trailblazer.salesforce.com/ideaView?id=08730000000Bpfw

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
AnudeepAnudeep (Salesforce Developers) 
Hi Adarsh, 

Unfortunately, you can't access the Last Login Date in the formula, but the field is accessible via APEX and Visual Flow.

See post Can the User's Last Login date be used in a formula? where a similar discussion is made

Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you