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
nlsnydernlsnyder 

Apex page using standardController Quote, how can I save the QuoteLineItems on page

I have the following code below and can get the line items for a quote and display in a table for editing.   But I can't figure out how I can save them.

The current save button only saves the Quote.  I want to save the edited quote line items when save is clicked.  How can I do that?

 

<apex:page standardController="Quote"> 

 
  <apex:form id="EditAllQuoteLine_Form">
 
    <apex:pageBlock title="Edit Quote Line Items for {!Quote.Name}" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!save}"   value="Save"/>
            <apex:commandButton action="{!cancel}" value="Cancel"/>
        </apex:pageBlockButtons>
  
        <apex:dataTable value="{!Quote.QuoteLineItems}" var="lines" id="theTable" rowClasses="odd,even"
                        styleClass="tableClass" cellpadding="3" cellspacing="3">      
            <apex:column headerValue=" Quantity ">
                 <apex:inputField value="{!lines.Quantity}" style="width: 50px;"/>
            </apex:column>
            <apex:column headerValue="  Product  " style="align: center;">
                 <apex:inputField value="{!lines.ProductName__c}" style="width: 150px;"/>
            </apex:column>            
            <apex:column headerValue=" List Price ">
                 <apex:inputField value="{!lines.ListPrice}"/>
            </apex:column>     
            <apex:column headerValue=" Sales Price " style="width: 70px;">
                 <apex:inputField value="{!lines.UnitPrice}" style="width: 50px;"/>
            </apex:column>  
            <apex:column headerValue=" Renew? ">
                 <apex:inputCheckbox value="{!lines.Renew__c}" onclick="renewClicked(this)" />
            </apex:column>
            <apex:column headerValue=" Prorate? ">
                 <apex:inputCheckbox value="{!lines.Prorate__c}" disabled="true"/>
            </apex:column>
            <apex:column headerValue="Begin Date">
                <apex:inputField value="{!lines.BeginDate__c}"  rendered="{!lines.Renew__c}"/>
            </apex:column>
            <apex:column headerValue="End Date">
                <apex:inputField value="{!lines.EndDate__c}" rendered="{!lines.Prorate__c}"/>             
            </apex:column>
            <apex:column headerValue=" Period ">
                 <apex:outputField value="{!lines.Period__c}"/>
            </apex:column>                                           
        </apex:dataTable>
        
    </apex:pageBlock>
  </apex:form>
</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
yvk431yvk431

You need an extension controller to save the line items from a Quote standard controller. 

 

 

--yvk