You need to sign in to do that
Don't have an account?

How to retrieve data based on a custom object detail page field value?
Hi All,
I have written the following code to retrieve data based on a field in a custom object page :
Apex Class:
Public class selaff {
public list<Product_PT__c> values;
private final Quote__c acct;
list<Product_PT__c> products ;
// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public selaff(ApexPages.StandardController stdController) {
this.acct = (Quote__c)stdController.getRecord();
}
Public List<SelectOption> getProduct() {
List<SelectOption> options = new List<SelectOption>();
//values = [select Name, Quote_Id__c, Product_Name__c
//from Quote__c];
values = [select Name, Base_Price__c from Product_PT__c where Name = :System.currentPageReference()
.getParameters().get('Product_Name__c')];
Integer j = [select count() from Product_PT__c where Name = :System.currentPageReference()
.getParameters().get('Product_Name__c')];
Integer i=0;
for(i=0; i<j; i++)
options.add(new selectoption(values[i].Name,values[i].Name));
return options;
}
}
page code :
<apex:page StandardController="Quote__c" extensions="selaff">
<apex:form ><apex:selectCheckboxes value = "{!products}">
<apex:selectOptions value="{!Product}"/>
</apex:selectCheckboxes><p/>
</apex:form>
</apex:page>
It is retrieving a blank page as a result. Is this the right way to refer to a value dynamically(as shown in the code with bold font)? Please help me with any other ways to achieve this functionality.