You need to sign in to do that
Don't have an account?
SteveMou
Visualforce Page require fields based on Different Profiles?
Does anyone know if it is possible on a single VF page to require a field ( Required="True") for only a specifc User Profile instead of just for all profiles? I have an Opportunity VF page where I only want a certain group of users based on their Profile to have the field as required.
My only option I see at the moment is creating separate VF pages and then assigning them to specific profiles.
Thanks for steering me in the right direction!! I got it:
required="{!OR($Profile.Name=='Profile1',$Profile.Name=='Profile2')}"/>
All Answers
Of course, if it's because you're enhancing a Visualforce page for other reasons, then you'll just need to conditionally require the field using a merge field:
required="{!$Profile.Name='Profile Name'}"
I wish I could use the Standard page layout, however we have the need for the VF page for other reasons.
So are you saying below I could change this code here:
<!-- <apex:outputField id="ofBDRep" value="{!opportunity.OwnerId}"/> --> <apex:inputField id="ifRFPBDREP" value="{!opportunity.RFP_BD_Rep__c}" required="true" />
To be:
<!-- <apex:outputField id="ofBDRep" value="{!opportunity.OwnerId}"/> --> <apex:inputField id="ifRFPBDREP" value="{!opportunity.RFP_BD_Rep__c}" required="{!$Profile.Name='BDREPProfile'}"
If so, can I specify more than just the 1 profile? I have a couple different profiles that I want to make it required for.
Thanks this is most helpful so far.
Thanks for steering me in the right direction!! I got it:
required="{!OR($Profile.Name=='Profile1',$Profile.Name=='Profile2')}"/>