You need to sign in to do that
Don't have an account?
how to redirect to standard page
Hi all,
iam facing problem using visual force page in my lead there a re four record types
one,two,three,four.
if i click new button->then it shows the record type selection page->then i select one ->it redirects to a visual force page name leadTest. because i over ridden new button with visual force page.
if i click two it should go to a standard page record type for two and a page layout is also assigned for it.
if i click three it should go to a standard page record type for three and a page layout is also assigned for it.
same like for four.
but here it is not redirecting to the standard page when iam passing the url in my controller .
can any help me. my code is:-
visualforce page
<apex:page StandardController="Lead" tabStyle="Lead" extensions="LeadController" action="{!redirectToPage}" >
Controller Method
public PageReference redirectToPage() {
String selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');
if (selectedRecordType == 'One')// id will be there
return Page.LeadTest.setRedirect(True);
else if(selectedRecordType == 'Two')
return new PageReference('/00Q/e?retURL=%2F00Q%2Fo&RecordType=012O00000000Acd&ent=Lead');
else if(selectedRecordType == 'Three')
return new PageReference('/00Q/e?retURL=%2F00Q%2Fo&RecordType=012O00000000Acn&ent=Lead');
else if(selectedRecordType == 'four')
return new PageReference('/00Q/e?retURL=%2F00Q%2Fo&RecordType=012O000000003ds&ent=Lead');
else
return null;
}
All Answers
Hi
Try the below code snippet as reference:
PageReference('/'+'00Q/e?retURL=%2F00Q%2Fo&RecordType=012O000000003ds&ent=Lead');
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hi Ankit,
Thanks for ur reply.
Ankit its not redirecting to standard page its redirecting to visual force page Lead Test.
I Want it should be redirected to standard page.
Thanks
Anil.B
hi j020
i used the nooverride option also but it still showing the same visual force page but its not redirecting to standard page.
my code for ur reference:
else if(selectedRecordType == 'Two')
{
p = new PageReference(/00Q/e?retURL=%2F00Q%2Fo&RecordType=012O00000000Acd&ent=Lead');
p.getParameters().put('nooverride','1');
return p;
}
else if(selectedRecordType == 'Three')
{
p = new PageReference(/00Q/e?retURL=%2F00Q%2Fo&RecordType=012O00000000Acn&ent=Lead');
p.getParameters().put('nooverride','1');
return p;
}
else if(selectedRecordType == 'Four')
{
p = new PageReference(/00Q/e?retURL=%2F00Q%2Fo&RecordType=012O000000003ds&ent=Lead');
p.getParameters().put('nooverride','1');
return p;
}