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
Carol McConnellCarol McConnell 

How to get the role of a user in a user field

I am creating reports and I need to get the user role however I'm not sure what the best way would be to get the role of a user in a user field.

I. E. I have a user field with John Smith, how do I pull in John Smith's role? This is not the contact owner but a user field which is a lookup field.

Thanks,
Best Answer chosen by Carol McConnell
SteveMo__cSteveMo__c
Just create a custom Formula(Text) field on the Object like this 
 
LookupFieldName__r.UserRole.Name

 

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi Carol,

You need to create a custom report type and pull the user fields based on lookup field.

Refer the below help article
https://help.salesforce.com/s/articleView?id=sf.reports_report_type_layouts.htm&type=5

If this helps, Please mark it as best answer.

thanks!!
 
SteveMo__cSteveMo__c
Just create a custom Formula(Text) field on the Object like this 
 
LookupFieldName__r.UserRole.Name

 
This was selected as the best answer
Carol McConnellCarol McConnell
This was exactly what I needed.  Thank you so much.