Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Visualforce Development
- :
- Re: Display parent detail page with child detail r...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Display parent detail page with child detail records in a Visualforc e page
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 12:34 AM
Hi All,
I need to display the parent detail page with the detail pages of all the related lists in a single visualforce page (Not worried about the length of the page)
Ex: I have myCustomObject__c as a related list under Account.
I would like to display Account detail page using <apex:detail>. Along with this, I need to add the <apex:detail > of the related records as well.For this I used <apexx:detail> in <apex:repeat> tag.
<apex:page standardController="Account" extensions="DominoController" id="thePage">
<apex:detail subject="{!Account}" relatedList="false"/>
<apex:repeat var="o" value="{!oList}" id="theRepeat">
<apex:detail subject="{!o}"/>
<hr/>
</apex:repeat>
<!-- repeat tag is for repaeting the related list records of the account -->
</apex:page>
####################
public with sharing class DominoController {
public sObject[] oList{ get; set;}
public Account Acc;
public String soqlQuery;
public DominoController(ApexPages.StandardController controller) {
this.Acc = (Account)controller.getRecord();
soqlQuery = 'select id, Name from MyCustomObject__c';
//soqlQuery holds all the custom object records of all Accounts
oList= Database.query(soqlQuery);
}
}
It displays the Account page fine. Below it, the detail page of all the related custom object records are also displayed. The problem is it display all the MyCustomObject records of all the Accounts, not just for this Account.
To get only this Account related list, I added WHERE condition in the soqlQuery,
soqlQuery = 'select id, Name from MyCustomObject__c where Account_Name__c='+Acc.Id;
but it throws the following error.
unexpected token: 'O00000074Mr8IAE'
An unexpected error has occurred. Your development organization has been notified.
The ID mentioned here is the Account ID of the record I am trying to open.
Any suggestions please?
Re: Display parent detail page with child detail records in a Visualforc e page
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 05:45 AM
Hi,
Looks like you are comparing Name (Account_Name__c) with Id in the Query, check it once.
Re: Display parent detail page with child detail records in a Visualforc e page
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-14-2012 05:34 PM
No, its a lookup field. It has ID in it.
Anyways, I did try with Customer_Name__r.Id, no change. Error.

