Any help would be greatly appreciated (either in actual code help or pointing me in the right direction).
I'm not much of a developer but was trying to get a related list from a custom object to display on another custom object. Basically I have a 'Bundled Products' object which has a products that are bundled together through a conjunction object ('Product_Bundle_Products_Association__c') connecting Bundled Products to Products. I want to display the related list of the conjunction object on another object which is 'Quote Bundles'. Right now I would be happy with just the Product Name but I am going to need more columns eventually.
The error that I am getting back on my page where I have dropped the visualforce at is 'Content cannot be displayed: SObject row was retrieved via SOQL without querying the requested field: Quote_Bundle__c.Product_Bundle__r'.
I'm thinking this should be a simple fix but for the life of me I can't figure out what to do. Here is my class:
public class QuoteBundleClass {
private List<Product_Bundle_Products_Association__c> pbpa;
private Quote_Bundle__c qb;
public QuoteBundleClass(ApexPages.StandardController controller) {
this.qb = (Quote_Bundle__c)controller.getRecord();
}
public List<Product_Bundle_Products_Association__c> getpbpa()
{
Quote_Bundle__c qbl = [Select id, Name, Product_Bundle__c, Product_Bundle__r.Id
From Quote_Bundle__c
Where id = :qb.Id];
if(qbl.Product_Bundle__c == null)
return null;
pbpa = [SELECT Id, Product__r.Name, Name
FROM Product_Bundle_Products_Association__c
WHERE Product__r.Id = :qb.Product_Bundle__r.Id];
return pbpa;
}
}
And here is my visualforce page:
<apex:page standardController="Quote_Bundle__c" extensions="QuoteBundleClass">
<apex:form >
<apex:pageMessages />
<apex:detail relatedList="true"></apex:detail>
<apex:pageblock id="CustomList" title="Bundled Products" >
<apex:pageBlockTable value="{!pbpa}" var="p" rendered="{!NOT(ISNULL(pbpa))}">
<apex:column>
<apex:outputField value="{!p.Name}" />
</apex:column>
</apex:pageBlockTable>
<apex:outputLabel value="No records to display" rendered="{!(ISNULL(pbpa))}" styleClass="noRowsHeader"></apex:outputLabel>
</apex:pageblock>
</apex:form>
Thanks in advance guys and gals!