Writing a VisualForce Page for Opportunity and having an issue with referencing the $UserRole.Id
. It saves the way its written but its not doing what we need it to on the actual VisualForce Page. It is working for the $UserRole.Name
tho :/ .
The code is as follows-
<apex:page Controller="CloseOppController"> <apex:form> <apex:pageBlock title="Opportunity Close Form"> <apex:pageMessages /> <apex:pageBlockSection title="Win/Loss Detail" collapsible="false"> <apex:inputField value="{!opportunity.StageName}" required="true"/> <br/> <apex:inputField value="{!opportunity.Closed_Reason__c}" required="{!IF($UserRole.Name != 'Sales Ops', true, false)}"/> <apex:inputField value="{!opportunity.Reason_Code__c}" required="{!IF($UserRole.Name != '***I have tried both the 15 digit and the 18 digit ID HERE***', true, false)}"/> <br/> <apex:inputField value="{!opportunity.Primary_Competitor__c}" required="{!IF($UserRole.Name != 'Sales Ops',true,false)}"/> <br/> <apex:inputField value="{!opportunity.Additional_Competitors__c}"/> <br/>
Thank you in advance!
IF(boolean_expression, true, false)
is always identical to simplyboolean_expression
. In other words, it is excessively verbose.