Is it possible to include a field that auto-populates the User Role as a field in an Opportunity record, similar to how the created by and owner fields are automatically included?

  • User Role of whom? Running User? Owner? Created By? Last Modified By? Other?
    – Adrian Larson
    Commented Mar 15, 2016 at 15:16
  • So, each of our sales people have a role that identifies the region they cover (i.e. Florida, Illinois, Georgia etc...) Those are the actual names of their Role within their user profiles. It doesn't have anything to do with where the customer location is, just the sales persons territory, as many of our customers have multiple locations throughout the US. I was trying to determine if there was any way to reflect that user profile "Role" on an opportunity record?
    – JORT
    Commented Mar 15, 2016 at 20:01

1 Answer 1


Presumably, you want the Opportunity owner's role name to appear, not the running user (as otherwise this would change on every page/report view across the org for a given Oppo X)

The Summer 13 and beyond way

Exploit the polymorphic relationship expression language for owner relationships

  1. Create a single formula field OwnerRole__c, type Text, with value = Owner:User.UserRole.Name

Note that the point-and-click editor for building formulas via lookups won't generate this expression, you have to type it in manually. A tip of the hat to @AdrianLarson for reminding me of this feature.

The Pre-Summer 13 way

  1. Create a Lookup field to User in Opportunity called Owner with API name = Owner__c
  2. Populate the field via Process Builder or trigger by straight copying from Opportunity.ownerId
  3. Create a formula field on Opportunity: owner__r.userRole.name

see this helpful post for more details

  • Why not formula off OwnerId? Can't make it work with polymorphism.
    – Adrian Larson
    Commented Mar 16, 2016 at 16:09
  • @AdrianLarson, not sure I understand your point, you can't build a formula field Owner.UserRole.Name - the formula editor doesn't allow this. Or, did you mean for me to add that to my answer as to why the quirky workaroound?
    – cropredy
    Commented Mar 16, 2016 at 16:58
  • I think you have to know what you're doing, you can't just select stuff. Take a look at Cross-Object Owner Fields: A Powerful New Formula Option
    – Adrian Larson
    Commented Mar 16, 2016 at 17:18
  • 1
    @AdrianLarson - thank you for bringing me out of the dark ages :-)
    – cropredy
    Commented Mar 16, 2016 at 17:30
  • Yay! :) Glad I could help.
    – Adrian Larson
    Commented Mar 16, 2016 at 17:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .