You need to sign in to do that
Don't have an account?
redirect login in controller
Hi there,
I am trying to redirect one recordtype to visualforce and other recordtypes to standard page...
I modified my Apex:page haeder like this:
<apex:page standardController="Opportunity"
extensions="ActionEditController" id="page"
action="{!if((Opportunity.Id=null),
if(($CurrentPage.parameters.RecordType != '012200000002Hdg'),urlfor('/006/e',null,[RecordType=$CurrentPage.parameters.RecordType],true),'' ),
if(($CurrentPage.parameters.RecordType != '012200000002Hdg'),urlfor('/006/e',null,[id=Opportunity.Id],true),URLFOR($Page.ActionEdit, Opportunity.id)))}">
when I open an existing record type it should redirect me to a visualforce page " ActionEdit" if the recordtype is '012200000002Hdg' now when I open that record type, it open a standard page '/006/e...'
what is wrong in my logic?
I was trying to implement the same logic in controller so it should be easier. but I get the following error:
Invalid root component None found in view /apex/ActionEdit?id=006R0000006x4I7IAI
my controller code:
public PageReference redirectToPage() {
if(action.Id==null)
{
if(getIsARPRecordtype())
{
return Page.ActionEdit.setRedirect(true);
}
else
{
return new PageReference('/006/e?nooverride=1');
}
}
else
{
if(getIsARPRecordtype())
{
PageReference editPage = new PageReference('/apex/ActionEdit');
editPage.getParameters().put('id',action.Id);
return editPage;
}
else
{
return new PageReference('/006/e?id='+action.id+'nooverride=1');
}
}
}
thank you for your help!
i would not put any logic in your action, but rather put your logic in your controller method and your action should just be the controller method invocation.
your controller action method returns the appropriate PageReference (with a setRedirect(True);)
All Answers
i would not put any logic in your action, but rather put your logic in your controller method and your action should just be the controller method invocation.
your controller action method returns the appropriate PageReference (with a setRedirect(True);)
Thank you!
got it!