5

I want to render one page block section on the page to certain user only.

<apex:pageBlockSectionItem rendered="{!$User.Name == opp.Security_Officer_Name__c}">
<apex:inputfield />
</apex:pageBlocksectionItem>

above code gives me an error for $User.Name Error Message "Field Name does not exist. Check spelling." and starange part is if I use $User.FirstName it works fine.

Does anyone know reason behind this? Any help is appreciated.

Many Thanks

1 Answer 1

2

That is strange, but my best guess is that the Name field is actually a composite field which gets some magic treatment in the backend. I notice that both FirstName and Lastname work, so perhaps you should use something like
{!$User.FirstName &' '& $User.LastName == opp.Security_Officer_Name__c}
or find a way to match on something other than Name...

1
  • 1
    your code helped me matching the first name and last name of the user. I don't need suffix name or anything from that Name field composition. So I better of using it your suggested way. Many thanks
    – Ricky
    Jan 27, 2016 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.