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
HobieHobie 

Question about apex:detail statement

I'm trying to modify the code from Grid Buddy to put this VF page at the bottom of the Related List section.  
Here is the original code that works great:


<apex:page standardController="Opportunity" sidebar="false" showHeader="false">
    <apex:variable var="gridPage" value="{!URLFOR($Page.GBFree__Grid)}" />
    <apex:variable var="gridPage" value="{!gridPage & IF(CONTAINS(gridPage, '?'), '&', '?')}" />
    <iframe id="gridFrame" scrolling="auto" height="480" width="100%" frameborder="0" src="{!gridPage}gname=Add Reviewers to Opportunity&id={!Opportunity.Id}&sbb=1&sh=0&ssb=0"></iframe>
</apex:page>

I tried using the apex:detail statement and received errors.  Can someone give me a hand with this?  Thank you!
William TranWilliam Tran
Where are you putting the Apex: detail?  after the iframe? in an inframe? something else? What errors did you get?

Thx
HobieHobie
@William,

I tried the below.  I'm not very experienced using Apex....just know enough to get myself in trouble.

<apex:detail var="gridPage" value="{!URLFOR($Page.GBFree__Grid)}" />
<apex:detail var="gridPage" value="{!gridPage & IF(CONTAINS(gridPage, '?'), '&', '?')}" />
Jai ChaturvediJai Chaturvedi
Hi Hobie,

Can you please try this:

<apex:detail subject="{!accountId}" relatedList="false" title="false"/>

In this "subject" attribute will contain the ID of the record for which details should be displayed.

Please mark this as solution if works.


Thanks
Jai

 
William TranWilliam Tran
Apex detail needs a specific object and id.  It does not take the same variables as the iframe.
 
<!-- For this example to render properly, you must associate the Visualforce page 
with a valid account record in the URL. 
For example, if 001D000000IRt53 is the account ID, the resulting URL should be: 
https://Salesforce_instance/apex/myPage?id=001D000000IRt53
See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
   
<apex:page standardController="Account">
   <apex:detail subject="{!account.ownerId}" relatedList="false" title="false"/> 
</apex:page>
For more info:

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_detail.htm

Thx
HobieHobie
@Jai and @William,

Thank you both for your help.  @William, thanks for the link - I will spend some time learing how to do this.

@Jai, I think you meant to type this:

<apex:detail subject="{!opportunity.accountId}" relatedList="false" title="false"/>

So I tried moving the VF page down to under the Related List section on the page layout with the above change I made, and the Layout editor still prevents me from doing so.  Am I missing something?