4

I have a field on the User object that users their Role's name to produce a text output.

When I try to reference this field in a visualforce page I get the titular error.

How can I reference this text field? Thanks!

Field BusinessUnit__c:

IF(CONTAINS( UserRole.Name , "Uno"), "Sales", 
IF(CONTAINS(UserRole.Name, "Dos"), "Sales", 
IF(CONTAINS(UserRole.Name, "Tres"), "Support", 
IF(CONTAINS(UserRole.Name, "CEO"), "Exec", 

"Shared"))))

Visualforce:

  <apex:outputLink value="/00O38000004hhNw?pv0={!$User.BusinessUnit__c}" id="theLink">

Error:

Error: Field UserRole.Name does not exist. Check spelling

9
  • So it lets you save the formula?
    – Adrian Larson
    Commented Mar 21, 2018 at 15:43
  • Yes, the formula field is saved on the User and produces the expected output.
    – jaw999
    Commented Mar 21, 2018 at 15:44
  • 1
    I could try this a field update to a text field on user obj when updated but that is not really satisfactory.
    – jaw999
    Commented Mar 21, 2018 at 16:26
  • Yeah WFR might be your best bet unfortunately.
    – Adrian Larson
    Commented Mar 21, 2018 at 16:43
  • It is working via a text field, that I update via WFR. Seems like a bug in SF!
    – jaw999
    Commented Mar 21, 2018 at 16:50

1 Answer 1

1

I changed the Formula field on the User object to a text field which is updated via workflow rule field update. Then the text field is referenced in the visualforce page and it works. Related bug? https://success.salesforce.com/issues_view?id=a1p3A000000IYtnQAG

1
  • I'd say it's unrelated to that Known Issue actually, since you were able to save the formula. There might be another KI for it, but I haven't checked.
    – Adrian Larson
    Commented Mar 21, 2018 at 21:14

You must log in to answer this question.

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