You need to sign in to do that
Don't have an account?
Jeff C.ax327
Multiple detail sections with different standard controllers?
I have a custom object with a 1-to-1 relationship with the Contact object via a lookup field. I want to create a Visualforce page that shows the Contact detail section on top and the customObj__c detail section below it. I know that I could work around it by using the Contact standard controller for the page and then lay out my custom object's fields by hand, but it would be fantastic if it were possible to do this using standard controllers for both, since that would allow the page layout tool to be used (and different layouts per record type, etc).
I'm still pretty new to Visualforce and custom controllers, extensions, and components. I thought maybe I could get this to work by putting an <apex:detail> section in a custom component. The first problem is that it appears there's no way to have a component use a standard controller. Secondly, when the component is included in the main Contact page, the <apex:detail> section takes on the scope of the Contact record, rather than pull from the controller of the component.
I guess I'm essentially trying to put together a sort of "Console" type of functionality where multiple detail sections are present and they relate to the main Contact record. Is this possible using Visualforce?
Thanks,
Jeff
Thank you for your reply, Mark. The method you describe works great. However, I just noticed a side effect that I can't seem to work around. The title & subtitle of the page seems to always take on the values for the object whose detail section was specified last. The top of the page should display a title of "Contact" and then the contact Name as the subtitle. Unfortunately, when I include a second detail section from a custom object, the title displays the label of my custom object and the subtitle displays the Name value from the record from my custom object (which is a meaningless Auto Number).
As as test, I added a third detail section (another standard one with no subject attribute) after the custom one, and then the correct Title/Subtitle is displayed again. So it sure does seem that it uses the object/record from the final detail section. Any way around this?
Hi Mark,
Adding a section header just... adds another section header. The default detail header is still there. I haven't taken the time to submit this to premier support just yet... but I guess I really should...
<apex:page standardController="Task" showHeader="true" tabStyle="task" title="Task" >
<apex:sectionHeader title="Task"/>
<apex:detail subject="{!Task.Id}" >
</apex:detail>
<br/>
<br/>
<br/>
<br/>
<apex:detail subject="{!Task.WhatId}">
</apex:detail>
</apex:page>
on the detail controls that you don't want to show the title (or all if you want a custom title).
<apex:page standardController="Task" showHeader="true" tabStyle="task" title="Task" >
<apex:detail subject="{!Task.Id}" >
</apex:detail>
<br/>
<br/>
<br/>
<br/>
<apex:detail subject="{!Task.WhatId}" title="false">
</apex:detail>
</apex:page>
Josh