You need to sign in to do that
Don't have an account?

Unable to use PageReference with IF
Basically I want to redirect to standard New page when a certain record type is selected, and a custom VF page when a different record type is selected. Here's my VF
<apex:page standardController="Award_Nominations__c" action="{!IF(!isPClubAward, pageRedirect, URLFOR('/apex/Pclub_Awards',null,[retURL=RetUrl, RecordType=pRecordType],true))}" extensions="SBS_Award_New_Redirect"> </apex:page>
The URLFOR part works fine, but if I use URLFOR for the standard new page I get the record type selection page twice. So I thought to add a method that returns a PageReference, pageRedirect:
public PageReference pageRedirect(){ String prefix = Award_Nominations__c.Sobjecttype.getDescribe().getKeyPrefix(); String param = '&CF00N40000002BitJ='+pAwrName+'&CF00N40000002BitJ_lkid='+pAwrId+'&retUrl='+pretUrl+'&RecordType='+pRecordType; return new PageReference('/'+prefix+'/e?nooverride=1&'+param);
I've tried pageRedirect, !pageRedirect and {!pageRedirect} in the VF without success. The error either says:
Unknown Property Award_Nominations__cStandardController.pageRedirect OR
Save error: Syntax error
OR if I change the PageReference to a variable instead of a mehtod with a getter it complains that it receives Text instead of Object.
What's the right way to do this?
I solved it by replacing the pageRedirect with a URLFOR which doesn't show the record type selection page twice (instead of the key prefix I originally had the $Action.Award_Nominations__c.new set)
URLFOR('/a4B/e',null,[CF00N40000002BitJ=AwrName,CF00N40000002BitJ_lkid=AwrId,retURL=RetUrl, RecordType=pRecordType],true)