function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prasan6Prasan6 

Add Visualforce related list to parent page layout

Hi Guys, 

I have a Page layout where child related lists exists, I would like to overide one of the child related list with a Visualforce page. I have created the visualforce page but how can I override the standard related lists with the custom visualforce page?

Thanks, 
Prasanna
 
Best Answer chosen by Prasan6
Veenesh VikramVeenesh Vikram
Hi Prasanna,

In the Outputlink, set the target attribute to blank in order to open New Tab.
Similarly, use Command Link instead of command button and set target as blank.
 
<apex:commandLink value="New Order" action="{!createNew}" target="_blank" styleClass="btn" style="padding: 4px 3px;text-decoration:none;"/>

<apex:pageBlockTable value="{!Order}" var="o">
        <apex:column headerValue="Action"> <apex:outputLink value="/{!o.id}/e?retURL=/apex/{!$CurrentPage.Name}" id="editLink" target="_blank"><b>Edit</b></apex:outputLink> |</apex:column>
 </apex:pageBlockTable>

Veenesh

All Answers

Veenesh VikramVeenesh Vikram
Hi Prasanna,

You can add your "Custom Related List" VF page in the record detail page layout. However, you cannot put the VF page in the related list section. However the best option you have is to include the VF page in the lower most section of the record detail section.
Hope this is helpful!
Veenesh
Prasan6Prasan6
 Thanks Vennesh. 
Prasan6Prasan6
Hi Veenesh,

I have another couple of questions on the Custom Visualforce page. 
- I have Edit link on the Custom VF page which works but does not open up in new window. Basically I need to this related list identical to the standard related list. 
- Similarly New button, works but opens in the same page does not open in a new window. 

Inshort this related list created from VF should be identical to any standard related list. - Could you please let me know how I could get this right?

My VF code: 
<apex:commandButton action="{!createNew}" value="New Order" />

<apex:pageBlockTable value="{!Order}" var="o" rendered="{!NOT(ISNULL(Order))}">
        <apex:column headerValue="Action"> <apex:outputLink value="/{!o.id}/e?retURL=/apex/{!$CurrentPage.Name}" id="editLink"><b>Edit</b></apex:outputLink> |
 </apex:pageBlockTable>        

Controller for New: 
public PageReference createNew() {   
    PageReference page = new  PageReference('/a04/e');
    page.setRedirect(true);
    return page; 
    }

Thanks, 
Prasanna
 
Veenesh VikramVeenesh Vikram
Hi Prasanna,

In the Outputlink, set the target attribute to blank in order to open New Tab.
Similarly, use Command Link instead of command button and set target as blank.
 
<apex:commandLink value="New Order" action="{!createNew}" target="_blank" styleClass="btn" style="padding: 4px 3px;text-decoration:none;"/>

<apex:pageBlockTable value="{!Order}" var="o">
        <apex:column headerValue="Action"> <apex:outputLink value="/{!o.id}/e?retURL=/apex/{!$CurrentPage.Name}" id="editLink" target="_blank"><b>Edit</b></apex:outputLink> |</apex:column>
 </apex:pageBlockTable>

Veenesh
This was selected as the best answer
Prasan6Prasan6
Hi Veenesh, 

Thanks for the update, but I want this to open up in the same page, just like any other standard related list.

Thanks, 
Prasanna
 
Veenesh VikramVeenesh Vikram
Prasanna,

Replace target="_blank" with target="_parent" and you will be good to go!

Veenesh
Prasan6Prasan6
Awesome. Thanks. Worked.