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
davcondevdavcondev 

Render lookup inputField based on permissions?

Lookup inputFields do not display on Visualforce pages if the user doesn't have at least read access to the related object.

 

Is there a way to detect this (interrogate user permissions? check whether the field is displayed?) and rendering appropriately instead of just having a missing field?

 

i.e. If user has object rights, show an inputField, otherwise show explanatory outputText.

 

A VF only solution is preferred rather than javascript or controller side logic.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

I believe you can test accessibility of a field via the $ObjectType global variable in a VF expression, though I'm not sure of the syntax and it is poorly documented.   Something like {!$ObjectType.object.Fields.fieldname.isAccessible} 

All Answers

aballardaballard

I believe you can test accessibility of a field via the $ObjectType global variable in a VF expression, though I'm not sure of the syntax and it is poorly documented.   Something like {!$ObjectType.object.Fields.fieldname.isAccessible} 

This was selected as the best answer
davcondevdavcondev

It's easy when you know how huh?

 

For my outputText I just added

 

rendered="{!!$ObjectType.myCustomObject__c.accessible}"