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
developer_forcedeveloper_force 

Retreiving all users using apex code

Hi,

 

Help needed in retreiving all the users in salesforce using Apex code.

 

Thanks

logontokartiklogontokartik

List<User> allUsers;

 

allUsers = [SELECT Id, Name from User];

 

Ispita_NavatarIspita_Navatar

Hi,

If you want to retrieve all active users then you can utilize the user = "inactive"  boolean property of User in your query.


                           List<User> usrlist = [select id, name, isActive from User where isactive = true];

else you want to access all user then you can exlude the filter on  “isactive” property.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.