+ Start a Discussion
Jeremy DeseezJeremy Deseez 

How can i show/edit a <List> of all Quotas on a Visual Force Page ?

Hi,

I'm trying to make a visualforce page to show/edit all Quotas with the name of the user associated with the Quotas.


Thak's a lot
SandhyaSandhya (Salesforce Developers) 
Hi Jeremy Deseez ,

You need to create the visual force page with a custom controller.
There is a good article here for your reference.

https://developer.salesforce.com/blogs/developer-relations/2012/01/soql-offset-in-spring-12.html
 
The example is for Account object complete with the pagination, but it is very easy to change it to Quote object.
 
And in your visual force page, you can display the quote list in a <apex:pageBlockTable> or <apex:dataTable>.
<apex:pageBlockTable> is usually my preferred choice because the table is automatically formatted with Salesforce look and feel.
 
Here is the example of the VF page:
 
<apex:page controller="QuoteTabController">
   
   <apex:form>
       <apex:pageBlock title="All Quotes">
            <apex:pageBlockTable value="{!quotes}" var="q">
                <apex:column value="{!q.Name}"/>
                <apex:column value="{!q.QuoteNumber}"/>
                <apex:column value="{!q.Status}"/>
            </apex:pageBlockTable>
            
            <br />
            <apex:commandLink action="{!previous}" value="Prev"/> &nbsp;
            <apex:commandLink action="{!next}" value="Next"/>
        </apex:pageBlock>
    </apex:form>

</apex:page>

There is also another example in below post which has edit option please refer that.

http://salesforce.stackexchange.com/questions/32067/custom-list-view-to-display-vf-page
 
Hope this helps you!

Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
 
Thanks and Regards
Sandhya

 
Jeremy DeseezJeremy Deseez
Hi Sandhya, Thanks a lot but i have that type of error "List controllers are not supported for ForecastingQuota" So is there any way to create List of ForecastingQuota ? Regards *Jérémy Deseez* Information System Specialist - Salesforce Developer | *Kyriba* 247 Bureaux de la Colline 92210 ST-Cloud - France www.kyriba.com | Twitter | LinkedIn | Blog
Jeremy DeseezJeremy Deseez
Hi everyone,

I make VFP like this,
 
<apex:page  standardController="ForecastingQuota" extensions="QuoteTabController" >
   
   <apex:form>

    {!hello} <p/>

       <apex:pageBlock title="All ForecastingQuotas" >
            <apex:pageBlockTable value="{!ForecastingQuota}" var="q">
                <apex:column value="{!q.QuotaAmount }"/>
                <apex:column value="{!q.QuotaOwnerId}"/>
                <apex:column value="{!q.StartDate}"/>
            </apex:pageBlockTable>
            
        
        </apex:pageBlock>
    </apex:form>

</apex:page>



And my Controller like this :
 
public with sharing class QuoteTabController {

//public list<ForecastingQuota> forecastList; 

	public QuoteTabController(ApexPages.StandardController controller) {

	}
		public String getHello() {
       		return 'Hello List ';
    	}
    	public List<ForecastingQuota> getForcastingQuotas(){
    	  	return null;
    	} 
}


But I don't know who to create my List of ForecastingQuota.
SandhyaSandhya (Salesforce Developers) 
Hi ,

I am not getting any such error as I don't have records its not displaying but no error.

User-added image

Thanks and Regards
Sandhya
Jeremy DeseezJeremy Deseez
Hi, 


It's work perfectly, i can see all my ForecastingQuota on my VFP with my Controller.


Now I wonder if I can insert a new ForecastingQuota with apex code or it's just with Dataloader ?

Regards
 
SandhyaSandhya (Salesforce Developers) 
Hi ,

You can insert the record in your apex code.
 
<apex:page standardController="ForecastingQuota" extensions="QuoteTabController" >
   
   <apex:form >

    {!hello} <p/>
<apex:PageBlock title="ForecastingQuotas" mode="edit">
     <apex:PageBlockButtons >
        <apex:commandButton action="{!Save}" value="save"/>
     </apex:PageBlockButtons>
 <apex:PageBlockSection columns="2">
   <apex:InputField value="{! ForecastingQuota.QuotaAmount}"/>
   <apex:Inputfield value="{! ForecastingQuota.QuotaOwnerId}"/>
   <apex:InputField value="{! ForecastingQuota.StartDate}"/>  
 </apex:PageBlockSection>
</apex:PageBlock>    
</apex:form> 
</apex:page>
 
public with sharing class QuoteTabController {

public ForecastingQuota forecastList; 

    public QuoteTabController(ApexPages.StandardController controller) {
    
    this.forecastList = (ForecastingQuota)controller.getRecord();

    }
        
}
Hope this helps you!


Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
 
Thanks and Regards
Sandhya

 
Jeremy DeseezJeremy Deseez
Hi,

Thanks for the response, but when I would insert with the <apex:InputField, nothing is happening on the ForecastingQuota Objet.
Is it possible or i have to upload it via the dataloader ?

Regards