You need to sign in to do that
Don't have an account?
Staci
Need an IF statement in Apex page, is it possible?
Here's my page code. I need to say If profile != 'GIS' then no dealer approver name needed, else ask for dealer approver name. is this possible? (I've commented where I need the IF statement
<apex:page standardController="Change__c" extensions="SubmitforApproval"> <apex:form id="frm"> <apex:detail subject="{!Change__c.Id}" relatedList="false" title="false"/> <apex:outputPanel id="tstpopup" rendered="{!IF(isDisplayPopUp ==true,true,false)}" > <apex:outputPanel styleClass="popupBackground" layout="block" /> <apex:outputPanel styleClass="custPopup" layout="block"> <apex:pageMessages > </apex:pageMessages> <apex:pageBlock > <apex:pageBlockSection columns="1" > <!--This is where I need the IF statement--> <apex:inputField label="Dealer Approver" value="{!Change__c.Dealer14__c}" required="true"/> <apex:inputField label="Change Implementor" value="{!Change__c.Change_Implementer__c}" required="true"/> <apex:inputField label="Test Plan" value="{!Change__c.Test_Plan1__c}" required="true" style="width: 500px" /> <apex:inputField label="Implementation Plan" value="{!Change__c.Implementation_Plan1__c}" required="true" style="width: 500px"/> <apex:inputField label="Backout Plan" value="{!Change__c.Backout_Plan1__c}" required="true" style="width: 500px"/> <apex:inputField label="Estimated Duration" value="{!Change__c.Estimated_Duration__c}" required="true"/> <apex:outputPanel > <apex:CommandButton action="{!save}" value="Save!"/> <apex:CommandButton action="{!cancel}" value="cancel"/> </apex:outputPanel> </apex:pageBlockSection> </apex:pageBlock> </apex:outputPanel> </apex:outputPanel> </apex:form>
One way to achieve this is to create two recordtypes say R1 and R2, and create two page layouts, say P1 and P2 for this object.
Set Dealer Approver visible in P1 and not in P2.
Associate P1 to R1 and P2 to R2
Set the profile of the user who does not need to see the Dealer Approver input box to P2.
Thanks
gm
rendered="{!if($Profile.Name !='GIS',FALSE,TRUE)}"