I need to override the edit link of a relatedlist with visualforce page. The visualforce page will do nothing but redirect the user to the standard edit page of the record. I tried the following but it keeps on performing the action again and again.
<apex:page standardController="Escrow_Contact__c" extensions="PWEscrowContactController" action="{!redirectToPage}">
</apex:page>
Controller:
public class PWEscrowContactController {
private final Escrow_Contact__c contact1 {get;set;}
public PWEscrowContactController(ApexPages.StandardController stdcontroller){
this.contact1 = (Escrow_Contact__c)stdController.getRecord();
}
public PageReference redirectToPage() {
return new ApexPages.StandardController(contact1).edit();
}
}
I need to accomplish this because I have used a relatedlist within Visualforce page and used the page in standard layout as a section and while performing edit within this Visualforce page it redirects me directly to the Visualforce page instead of redirecting me to the parent record page.
The url when edit link is clicked from standard related list layout is, https://cs13.salesforce.com/a0aW0000001S6nB/e?retURL=%2Fa01U000000eZke5
but the url when edit link is clicked from the Visualforce page section of related list layout is, https://cs13.salesforce.com/a0aW0000001S6nB/e?retURL=%2Fapex%2FvfEscrowContacts%3Finline%3D1%26id%3Da01U000000eZke5
I need to overcome this issue.