You need to sign in to do that
Don't have an account?
How can I query and display data of a specific user?
Hello, I am fairly new and am experimenting with Apex & Visualforce.
I managed to figure out how to display a list of all the users in my org, but I can't figure out how to display a specific user.
Apex Class:
Is there a way to either populate the data about a specific user using their User Id or doing a query for a specific user?
I know I can display the current logged in user data by using: {!$User.FirstName} for instance, but I want to display a specific user, not the current logged in user.
Help is greatly appreciated.
I managed to figure out how to display a list of all the users in my org, but I can't figure out how to display a specific user.
Apex Class:
public class UserResultsController { public List<String>getListOfUsers(){ List<string> ourUsers = new list<string>(); for(User a:[SELECT Name FROM User]){ ourUsers.add(a.Name); } return ourUsers; } }Apex Page:
<apex:page controller="UserResultsController" > <apex:repeat value="{!ListOfUsers}" var="usl"> <apex:outputText value="{!usl}"/> <br/> </apex:repeat> </apex:page>
Is there a way to either populate the data about a specific user using their User Id or doing a query for a specific user?
I know I can display the current logged in user data by using: {!$User.FirstName} for instance, but I want to display a specific user, not the current logged in user.
Help is greatly appreciated.
Please refer the below code with the help of which you can search for a User and its corresponding details will be shown :
VF Page :-
Controller :-
All Answers
--
Thanks,
Prashant
Please refer the below code with the help of which you can search for a User and its corresponding details will be shown :
VF Page :-
Controller :-
Glad I could help you out.