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
Shirley MaglioShirley Maglio 

How to display the result of a query onto the Quote Edit page?

Hi,

Can anyone advise on how to do this via Apex and Visualforce?  Or other ways and means? 

Any help is greatly appreciated!

Thanks,
Shirley Maglio
Best Answer chosen by Shirley Maglio
vmanumachu1.393650924860069E12vmanumachu1.393650924860069E12
You can like the below, as an example i am displaying Contacts related to account.

--Controller:

public with sharing class apxShowDataTable {
Account acc;
public apxShowDataTable(Apexpages.StandardController cont)
{
  acc = (Account)cont.getRecord();
}
public List<Contact> getContacts()
{
  List<Contact> lstCont = [select FirstName, LastName, Phone from Contact  where AccountId=: acc.Id];
  return lstCont;
}
}


--VF Page

<apex:page standardController="Account" extensions="apxShowDataTable">
<apex:form >
<apex:pageBlock title="Account">
<apex:pageBlockSection title="Information">
<apex:inputField value="{!Account.Name}"/>
<br></br>
<apex:pageBlockTable value="{!Contacts}" var="con">
<apex:column value="{!con.FirstName}"/>
<apex:column value="{!con.LastName}"/>
<apex:column value="{!con.Phone}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

All Answers

vmanumachu1.393650924860069E12vmanumachu1.393650924860069E12
You can like the below, as an example i am displaying Contacts related to account.

--Controller:

public with sharing class apxShowDataTable {
Account acc;
public apxShowDataTable(Apexpages.StandardController cont)
{
  acc = (Account)cont.getRecord();
}
public List<Contact> getContacts()
{
  List<Contact> lstCont = [select FirstName, LastName, Phone from Contact  where AccountId=: acc.Id];
  return lstCont;
}
}


--VF Page

<apex:page standardController="Account" extensions="apxShowDataTable">
<apex:form >
<apex:pageBlock title="Account">
<apex:pageBlockSection title="Information">
<apex:inputField value="{!Account.Name}"/>
<br></br>
<apex:pageBlockTable value="{!Contacts}" var="con">
<apex:column value="{!con.FirstName}"/>
<apex:column value="{!con.LastName}"/>
<apex:column value="{!con.Phone}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
This was selected as the best answer
Shirley MaglioShirley Maglio
HI vmanumachu, Thank you.  This is a good example.  ~Shirley.