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
ts44ts44 

Apex:RelatedList Question

Hello!

 

I have just developed a visualforce page that is an extension to a standardController. I also added the visualforce page to the layout of my standard object and inside the VF page I'm using a relatedList. Everything works great, however I have one issue. Whenever I click on "New <whatever sObject>" on my relatedList, it takes me to correct page, but it opens the layout all over again (it is showing the sidebars and header twice, inside the portion where my visualforce page is). Is there any way of eliminating this, or a way to just open the add a new record without reopening another layout inside the visualforce portion?

 

Thank You

 

Best Answer chosen by Admin (Salesforce Developers) 
Devendra@SFDCDevendra@SFDC

Hi,

 

Try using below code,

 

VF page : EmployeeDetailPage

 

<apex:page standardController="Employee__c">
	<apex:detail relatedList="true" showchatter="true"/>
</apex:page>

Override the Standard View from Standard Button and Links section of Employee object using the above : EmployeeDetailPage.

 

Set the pagelayout for Employee__c. Only keep Education list on Employee pagelayout.

 

Hope this helps :)

 

Thanks,

Devendra 

All Answers

SurekaSureka

Hi,

 

Use Sidebar=false & header=false in the <apex:page> tag.

 

Let me know if it helps.

 

Thanks

ts44ts44

Thanks for your reply Sureka. However, my page does have showHeader="false" and  sidebar="false". Take a look below:

 

 

Before

Above is what I created. This is fine and works great. The education list is a <apex: relatedList /> tag. The problem is when I click "New Education". This is what it looks like after:

 

 

Notice how since it is an embedded visualforce inside a a layout, it reopens inside it :(. Is there another control that is similar to relatedLists I can use that has the same functionality that shows the many to one tables (master-detail)? I'm also thinking there might something I can do in the controller, but I don't know enough about it yet.

 

Thanks!

Devendra@SFDCDevendra@SFDC

Hi,

 

Can you post your code, which you are using to display detail of record and its related list?

 

Thanks,

Devendra

ts44ts44

Here is the educations related list section in the visualforce:

 

<apex:page standardController="Employee__c" sidebar="false" extensions="empExtController" showHeader="false">

<h2>Educations Related List</h2>
            <p>
                <apex:relatedList list="Educations__r"  />
            </p>  

 

 

 

 

Here is my save method inside the controller:

 

 

Here is my save method inside the controller:

public class empExtController {

	ApexPages.StandardController stdCtrl;
	private String queryString;

	public empExtController(ApexPages.StandardController controller)
	{ 
		stdCtrl=controller;
	}	

	public PageReference save()
	{
		stdCtrl.save();
		return null;
	}

}

 

I think I may end up having to create my Educations table from stratch and not use the <apex:relatedList> tag.

 

Devendra@SFDCDevendra@SFDC

Hi,

 

Try using below code,

 

VF page : EmployeeDetailPage

 

<apex:page standardController="Employee__c">
	<apex:detail relatedList="true" showchatter="true"/>
</apex:page>

Override the Standard View from Standard Button and Links section of Employee object using the above : EmployeeDetailPage.

 

Set the pagelayout for Employee__c. Only keep Education list on Employee pagelayout.

 

Hope this helps :)

 

Thanks,

Devendra 

This was selected as the best answer
ts44ts44

Thank You Devendra. That pointed me in the right direction.