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
jhartjhart 

Visualforce for custom related lists on standard objects?

Hi,

I'd like to be able to use Visualforce to create custom related lists on standard objects (particular Account/Contact/Lead).  The use case here is to have related-list-like functionality when no direct relationship exists in the data model - for example, let's say I've got a { Contact : Object } relationship, and I want to aggregate this up into the Account View.  Some sort of materialized view functionality would also satisfy my needs, but no such functionality exists and Apex Triggers cannot be used to maintain materialized views due to trigger execution limits.

Back to my question about using Visualforce - Having read the Visualforce Developer's Guide & the Force.com cookbook, I get the sense this is not in fact possible.  I could use an s-control snippet to get to roughly the same place (create an iframe whose content is sourced from a Visualforce page) but it would be preferable to embed the code within the standard page, rather than using s-controls.

At an even more general level, it appears that Visualforce can't be used to customize standard pages at all. Is that also correct?

Just making sure I'm not missing anything.

thanks,
john

jhartjhart
I do see the Page Layout editor includes in its legend the tantalizing new "<P> Page" item, but I don't know how to make an Apex Page available to the Page Layout editor.

Any help greatly appreciated.
DevAngelDevAngel
Hi jhart,

You can use Visualforce to customize the standard layout in the way that you described (create a url s-control that points to a Visualforce page and add that s-control to the layout).  You don't use Visualforce to change the standard layout though.

In that case you will get a frame.  I don't see any other way around it.

Cheers
jhartjhart
Thanks Dave.

So what's up with the new "<P> Page" object type in the Page Layout editor (in the "Legend" area, just below the "<S> Custom S-Control" type?

thanks,
john

DevAngelDevAngel
Not sure, didn't notice it 'til you pointed it out.  :smileysurprised:

I'll have to knock a few cubicle doors and find out.



Cheers
mtbclimbermtbclimber
That allows you to pull in visualforce pages as you would otherwise pull in scontrols inline into the page layout. If you don't see any pages it is because none of your pages are bound to the standard controller for the object in question.

There are two ways to look at custmizing standard pages:

1) Using standard page layouts as the container for visualforce pages
2) Using pages as the container and pulling in the standard page layout definition using <apex:detail>

Only in the case of 2) can you simulate a related list in the expected position today.

The key thing to remember is that we require standard controller (for the type in question) binding for pages used as overrides or inline.  If you want to add to the standard controller we will be supporting that in the winter release through extensions with the mix-in pattern that was shown at dreamforce.

Hope that helps.

Regards,
dchasmandchasman
VF pages can be used from almost all locations that
scontrols can be used,e.g. inline in layouts, as the
target for an override, link, tab etc. In the case of inlines
and overrides your page needs to be bound to the
standard controller for the type of object that the layout or action
is associated with.

For example:

<apex:page standardController="account">

could be used inlined in an account
detail page.

Message Edited by dchasman on 09-21-2007 01:13 PM

BritishBoyinDCBritishBoyinDC
Hi

I would like to get the AccountContactRole object to appear as a standard related list in the Contact object - but if I use apex:pageBlock as the component, it appears at the bottom of the screen, after the related lists and show more/fewer option. Looking at your reply, should I be able to make my code below render that list in the expected position as part of the related lists, or is it simply not possible?

Code:
<apex:page controller="MySecondController" tabStyle="Contact">
<apex:detail subject="{!contact}" relatedlist="true">

<apex:pageBlock title="Contact Roles">
<apex:dataTable value="{!contact.AccountContactRoles}" var="contactroles" rowClasses="odd,even" cellPadding="3">
<apex:column> {!contactroles.Account.Name}</apex:column>             
<apex:column>{!contactroles.Role}</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:detail>
</apex:page>


Thanks!
geetageeta
Hi BritishBoyinDC,
 
Did you get a response to your question? I have the same issue and would appreciate if you found an alternative.
 
Thanks,
Geeta
BritishBoyinDCBritishBoyinDC
I didn't, though VisualForce seems to have much more functionality available now, so I'll most likely try again in the next couple of weeks and see it is now possible...
seekhelpseekhelp

Hi,

   Is there a way to display custom related list, which does not correspond to an object, under a standard object? Look at the following code

 

<apex:page standardController="Account" extensions="Account_View_Ctl">

<apex:detail relatedList="true">
<apex:pageBlock title="New Related List">
<apex:pageBlockSection >
{!pgmsg}
</apex:pageBlockSection>
</apex:pageBlock>
</apex:detail>
<apex:outputField value="{!Account.Name}" rendered="false"/>
</apex:page>

 

I want this page block section to be displayed amongst other related list but with this markup it is displayed at the end of detail page after links "Back to Top" and "Show more or fewer records". Is there any possible way of displaying this custom section along with my related list?