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
GetlinGetlin 

SOQL: getting users and role information

Hi,

 

I try to get information about users and roles(i need get role's name for each user)

 

This query doesn't work:

select u.Id, u.Name, ur.Name  from User u, UserRole ur where u.UserRoleId = ur.Id

 

Is there other way to get this information ?

 

Thanks!

GetlinGetlin

Hi,

 

This works for me - select Id, Name, UserRole.Name  from User

 

Thanks!

b-Forceb-Force

 

Try this,

 

 

Select u.Alias, u.UserRoleId, u.UserRole.Id, u.UserRole.Name from User u

 

 

 

Thanks,

Bala