0 votes
1 view
in Salesforce by (11.9k points)

I want to show the last login date on my site template page, how to do that? I tried to use {!$User.LastLoginDate}, but it says "Field LastLoginDate does not exist. Check to spell".

Please help

1 Answer

0 votes
by (30.1k points)

It seems like that field is not exposed through the $User global variable. You could exhibit a date property in your page controller and query for the with SOQL.

public DateTime lastlogin{get;set;}

controller: 

User u = [SELECT LastLoginDate FROM User WHERE Id =:UserInfo.getUserId()];

lastlogin = u.LastLoginDate;

VF: {! lastlogin }

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...