Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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 (32.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 }

To learn in-depth about Workflow in Salesforce, sign up for an industry based Salesforce Training.

Related questions

0 votes
1 answer
+1 vote
1 answer
+1 vote
1 answer
0 votes
1 answer

Browse Categories

...