You need to sign in to do that
Don't have an account?
Dipa87
How to get login hours of a particular profile using apex?
Is there a way to retrieve the login hours for a profile using apex?
I want start and end time for a particular user.
Thanks in advance!
Hello,
I don't think there's currently a way to get the end time. Not from LoginHistory object anyway. LoginHistory contains only the start time. link
Also, what happens when the user connects from multiple sources, like a dev who uses at the same time force.com ide, chatter and the browser. Would that time be cumulative?
Regards,
Adi
Yes Adrian , But can we retrieve start and end time from the profile.
In profile we have something called login hours. Can we get the login hours from profile using apex.
The LoginHistory object supports query() so you can retrieve records from it using a soql in your apex code.
For example:
The problem is the object only has the start time(LoginTime) . There's no end time, no way to see when has the user logged off.
I have got two fields named StartDay and EndDay in User object.
but not able to query those fields.
Can anyone tell me how to query StartDay and EndDay fields from user object.
Question: How do you populate StartDate & EndDate in the first place?
We cannot query StartDate and EndDate from User object.
I have found out an alternative solution.
Created two formula text fields(Start_Time__c,End_Time__c) in User object.
which will store the StartDate and EndDate field values like dis : text(Startdate)
Its working fine.
Now I am able to retrieve the value in the VF page like dis {!$user.Start_Time__c}