• gPetrie
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

I have a visualforce page with a StandardController="Quote" and an extension controller.  I need to pull up a list of some of the QuoteLineItems, related to the quote display them in inputfields, update them on the visualforce page, then save the updated records.  I have no problem bringing up the records and displaying them, however when I go to update the records, the records are not updated.   Have tried everything, including the documentation, but nothing seems to be working.  Seems simple, I must be doing something fundamentally wrong.

 

Here is the relevant markup:

 

<apex:page StandardController="Quote" Extensions="AddPartController" wizard="true">

    <apex:Pageblock Title="STEP 2: Add the New Products to your Quote Here" >

        <apex:pageblockbuttons location="top">

            <apex:form >
                <apex:commandButton Value="Add to Current Quote" action="{!AddToCurrentQuote}" />
                <apex:commandButton Value="Cancel" />
            </apex:form>
        </apex:pageblockButtons>
        <br/>
        <apex:form >
            <apex:datatable value="{!PendingQuoteLineItemList}" var="qli" width="100%">
               <apex:column headerValue="Product Name" Value="{!qli.PricebookEntry.Product2.Name}" style="width:100px"/> 
               <apex:column headerValue="Product Alias" style="width:100px" >
                   <apex:inputfield value="{!qli.Product_Alias__c}" />
               </apex:column>
               <apex:column headerValue="Line Item Description" style="width:100px" >
                   <apex:inputfield value="{!qli.Description}" />
               </apex:column>
               <apex:column headerValue="Source" style="width:100px" >
                    <apex:inputfield value="{!qli.Source__c}" />
               </apex:column>
               <apex:column headerValue="Unit Cost" style="width:100px" >
                   <apex:inputfield value="{!qli.Cost__c}" />
               </apex:column>
               <apex:column headerValue="List Price" value="{!qli.ListPrice}" style="width:100px" />
               <apex:column headerValue="Discount" style="width:100px" >
                   <apex:inputfield value="{!qli.Discount}" />
               </apex:column>
               <apex:column headerValue="Sales Price" style="width:100px" >
                   <apex:inputfield value="{!qli.UnitPrice}" />
               </apex:column>
               <apex:column headerValue="Quantity" style="width:100px" >
                   <apex:inputfield value="{!qli.Quantity}" />
               </apex:column> 
               <apex:column headerValue="Enhanced List Desc" style="width:100px" >
                   <apex:inputfield value="{!qli.Enhanced_List_Desc__c}" />
               </apex:column>

           </apex:datatable>
           <br/>
        </apex:form> 
    </apex:Pageblock>
    <br/>
    <br/>

</apex:page>

 

And here is the relevant Controller code:

 

   List<QuoteLineItem> PendingQuoteLineItemList{get; set;}

 

 

    public  ApexPages.StandardSetController setCon{
        get {
          if(setCon == null){
                SetCon = new ApexPages.StandardSetController
                                            (Database.getQueryLocator
                                            ([SELECT ID,
                                                     QuoteID,
                                                     PricebookEntryID, 
                                                     PricebookEntry.Product2.Name, 
                                                     Source__c, 
                                                     Product_Alias__c, 
                                                     Description, 
                                                     Cost__c, 
                                                     Discount, 
                                                     UnitPrice, 
                                                     Quantity, 
                                                     Enhanced_List_Desc__c, 
                                                     ListPrice 
                                                FROM QuoteLineItem 
                                               WHERE QuoteID = :QtHdrID 
                                                 AND PricebookEntryID 
                                                 IN  :ListOfPricebookEntryID]
                                                 )
                                                 );
                }
                return setCon;    
            }
            set;
    }
    
    public List<QuoteLineItem> getPendingQuoteLineItemList(){
        PendingQuoteLineItemList = setCon.getRecords();
        return (list<QuoteLineItem>) setCon.getRecords();
    }

 

 

 

      Public void setPendingQuoteLineItemList(List<QuoteLineItem> PendingQuoteLineItemList){
          this.PendingQuoteLineItemList = PendingQuoteLineItemList;
      }   

 

 

    public pagereference AddToCurrentQuote(){
        update PendingQuoteLineItemList;
        pageReference returnPage = new pageReference('/' + QtHdrID);
        returnPage.setRedirect(true);
        return returnPage;
    }

 


If anybody can tell me what I am doing wrong I would be appreciative!

 

 

I have a visualforce page with a StandardController="Quote" and an extension controller.  I need to pull up a list of some of the QuoteLineItems, related to the quote display them in inputfields, update them on the visualforce page, then save the updated records.  I have no problem bringing up the records and displaying them, however when I go to update the records, the records are not updated.   Have tried everything, including the documentation, but nothing seems to be working.  Seems simple, I must be doing something fundamentally wrong.

 

Here is the relevant markup:

 

<apex:page StandardController="Quote" Extensions="AddPartController" wizard="true">

    <apex:Pageblock Title="STEP 2: Add the New Products to your Quote Here" >

        <apex:pageblockbuttons location="top">

            <apex:form >
                <apex:commandButton Value="Add to Current Quote" action="{!AddToCurrentQuote}" />
                <apex:commandButton Value="Cancel" />
            </apex:form>
        </apex:pageblockButtons>
        <br/>
        <apex:form >
            <apex:datatable value="{!PendingQuoteLineItemList}" var="qli" width="100%">
               <apex:column headerValue="Product Name" Value="{!qli.PricebookEntry.Product2.Name}" style="width:100px"/> 
               <apex:column headerValue="Product Alias" style="width:100px" >
                   <apex:inputfield value="{!qli.Product_Alias__c}" />
               </apex:column>
               <apex:column headerValue="Line Item Description" style="width:100px" >
                   <apex:inputfield value="{!qli.Description}" />
               </apex:column>
               <apex:column headerValue="Source" style="width:100px" >
                    <apex:inputfield value="{!qli.Source__c}" />
               </apex:column>
               <apex:column headerValue="Unit Cost" style="width:100px" >
                   <apex:inputfield value="{!qli.Cost__c}" />
               </apex:column>
               <apex:column headerValue="List Price" value="{!qli.ListPrice}" style="width:100px" />
               <apex:column headerValue="Discount" style="width:100px" >
                   <apex:inputfield value="{!qli.Discount}" />
               </apex:column>
               <apex:column headerValue="Sales Price" style="width:100px" >
                   <apex:inputfield value="{!qli.UnitPrice}" />
               </apex:column>
               <apex:column headerValue="Quantity" style="width:100px" >
                   <apex:inputfield value="{!qli.Quantity}" />
               </apex:column> 
               <apex:column headerValue="Enhanced List Desc" style="width:100px" >
                   <apex:inputfield value="{!qli.Enhanced_List_Desc__c}" />
               </apex:column>

           </apex:datatable>
           <br/>
        </apex:form> 
    </apex:Pageblock>
    <br/>
    <br/>

</apex:page>

 

And here is the relevant Controller code:

 

   List<QuoteLineItem> PendingQuoteLineItemList{get; set;}

 

 

    public  ApexPages.StandardSetController setCon{
        get {
          if(setCon == null){
                SetCon = new ApexPages.StandardSetController
                                            (Database.getQueryLocator
                                            ([SELECT ID,
                                                     QuoteID,
                                                     PricebookEntryID, 
                                                     PricebookEntry.Product2.Name, 
                                                     Source__c, 
                                                     Product_Alias__c, 
                                                     Description, 
                                                     Cost__c, 
                                                     Discount, 
                                                     UnitPrice, 
                                                     Quantity, 
                                                     Enhanced_List_Desc__c, 
                                                     ListPrice 
                                                FROM QuoteLineItem 
                                               WHERE QuoteID = :QtHdrID 
                                                 AND PricebookEntryID 
                                                 IN  :ListOfPricebookEntryID]
                                                 )
                                                 );
                }
                return setCon;    
            }
            set;
    }
    
    public List<QuoteLineItem> getPendingQuoteLineItemList(){
        PendingQuoteLineItemList = setCon.getRecords();
        return (list<QuoteLineItem>) setCon.getRecords();
    }

 

 

 

      Public void setPendingQuoteLineItemList(List<QuoteLineItem> PendingQuoteLineItemList){
          this.PendingQuoteLineItemList = PendingQuoteLineItemList;
      }   

 

 

    public pagereference AddToCurrentQuote(){
        update PendingQuoteLineItemList;
        pageReference returnPage = new pageReference('/' + QtHdrID);
        returnPage.setRedirect(true);
        return returnPage;
    }

 


If anybody can tell me what I am doing wrong I would be appreciative!

 

 

Hi - I can't seem to figure out how to get my setter method to bind to my page.  The none of my setter methods are being called.

 

public with sharing class ConRegWizController {

 
Account account;
Shadow_Account__c shadowacct;
Contact primarycontact;

User user = [SELECT id, AccountId, ContactID FROM User WHERE id = : UserInfo.getUserId()];

 public ConRegWizController() {
            //Retrieve records for Portal Users
            if(user.AccountID != NULL ) {
            account = [SELECT id, Name FROM Account WHERE id = : user.AccountID];
            shadowacct = [SELECT id, Name, Con_Annual_Revenue__c, Con_In_Business_Since__c, City__c, Country__c, Postal_Zip_Code__c, Province_State__c, Street__c, Con_Legal_Business_Name__c, Con_Number_of_Employees__c, Con_Type_of_Business__c, Website__c, Con_Work_Category__c FROM Shadow_Account__c WHERE Account__c = : user.AccountID];
            primarycontact = [SELECT id, LastName, FirstName, Phone, MobilePhone, Email, Primary_Contact__c FROM Contact WHERE AccountID = :user.AccountID AND Primary_Contact__c = TRUE ];
            }
           

            
            //Retrieve records for Standard Users
            else        {
            account = [SELECT id, Name FROM Account WHERE id = :ApexPages.currentPage().getParameters().get('id')];
            shadowacct = [SELECT id, Name, Con_Annual_Revenue__c, Con_In_Business_Since__c, City__c, Country__c, Postal_Zip_Code__c, Province_State__c, Street__c, Con_Legal_Business_Name__c, Con_Number_of_Employees__c, Con_Type_of_Business__c, Website__c, Con_Work_Category__c FROM Shadow_Account__c WHERE Account__c = :ApexPages.currentPage().getParameters().get('id')];
            primarycontact = [SELECT id, LastName, FirstName, Phone, MobilePhone, Email, Primary_Contact__c FROM Contact WHERE AccountID = :ApexPages.currentPage().getParameters().get('id') AND Primary_Contact__c = TRUE ];
            }
            
                       
 }


  public Account getAccount() {
      if(account == null)  account = new Account();
      return account;
   }
   
  public void setAccount(Account ACCT)
    {
        Account = ACCT;
    }

 public Shadow_Account__c getShadowAcct() {
      system.debug('DEBUG: shadowacct =' + shadowacct);
      if(shadowacct == null) shadowacct = new Shadow_Account__c ();
      return shadowacct;
   }
   
     public void setShadowAcct(Shadow_Account__c SA)
    {
         system.debug('DEBUG: Entering Shadow Acct Setter method'); //Does not enter method
        ShadowAcct = SA;
    }

  public Contact getprimaryContact() {
       system.debug('DEBUG: primarycontact =' + primarycontact);
      if(primarycontact == null) primarycontact = new Contact();
      return primarycontact;
   }

  public void setprimaryContact(Contact CONT)
    {
        system.debug('DEBUG: Entering Primary Contact Setter method'); //Does not enter method
        primaryContact = CONT;
    }



public PageReference step1() {
      return Page.ContractorRegistrationStep1 ;
    
   }

   public PageReference step2() {
     return Page.ContractorRegistrationStep2;
    
   }

   public PageReference step3() {
      return Page.ContractorRegistrationStep3 ;
     
   }
   
   
   public PageReference step4() {
      return Page.ContractorRegistrationStep4 ;
     
   }
   
   public PageReference step5() {
      return Page.ContractorRegistrationStep5 ;
    
   }

Public pageReference Save() {
  
  system.debug('DEBUG: shadowacct =' + shadowacct.Con_Legal_Business_Name__c);
  system.debug('DEBUG: primarycontact =' + primarycontact.LastName);
   update shadowacct;
   update primarycontact;
   
   /*PageReference ContractorDetails = Page.ContractorDetails;
   ContractorDetails.getParameters().put('ID',acct.ID);
   ContractorDetails.setRedirect(true);   
   return ContractorDetails; */
   
   return Page.ContractorRegistrationStep5;
  
}
     

 

<apex:page sidebar="false" Controller="ConRegWizController">
    <apex:sectionHeader title="Contractor Registration" subtitle="1 of 5 Company & Contact Information"/>   
         <apex:form >
           <apex:pageBlock mode="Detail" >
 
           <apex:pageBlockButtons location="both">
                <apex:commandButton action="{!Save}" value="Save & Exit" styleClass="btn" onclick="return confirmExit()" immediate="true"/>
                 <apex:commandButton action="{!Cancel}" value="Cancel" styleClass="btn" onclick="return confirmCancel()" immediate="true"/>
                <apex:commandButton value="Next" action="{!Step2}" styleClass="btn" />
           </apex:pageBlockButtons> 
           
           <apex:pageBlockSection title="{!Account.Name} Information">
           <apex:inputField value="{!ShadowAcct.Name}"/>
           <apex:inputField value="{!ShadowAcct.Con_Work_Category__c}"/>
           <apex:inputField value="{!ShadowAcct.Con_Legal_Business_Name__c}"/>
           <apex:inputField value="{!ShadowAcct.Con_Type_of_Business__c}"/>
           <apex:inputField value="{!ShadowAcct.Street__c}"/>
           <apex:inputField value="{!ShadowAcct.Con_Number_of_Employees__c}"/>
           <apex:inputField value="{!ShadowAcct.City__c}"/>
           <apex:inputField value="{!ShadowAcct.Con_Annual_Revenue__c}"/>
           <apex:inputField value="{!ShadowAcct.Province_State__c}"/>
           <apex:inputField value="{!ShadowAcct.Con_In_Business_Since__c}"/>
           <apex:inputField value="{!ShadowAcct.Postal_Zip_Code__c}"/>
           <apex:inputField value="{!ShadowAcct.Website__c}"/>
           <apex:inputField value="{!ShadowAcct.Country__c}"/>
         </apex:pageBlockSection>
         
           
           <apex:pageBlockSection title="Primary Contact Information" rendered="{!PrimaryContact.Primary_Contact__c}">
            <apex:inputField value="{!PrimaryContact.FirstName}"/>
            <apex:inputField value="{!PrimaryContact.Phone}"/>
            <apex:inputField value="{!PrimaryContact.LastName}"/>
            <apex:inputField value="{!PrimaryContact.MobilePhone}"/>
            <apex:inputField value="{!PrimaryContact.Email}"/>
           </apex:pageBlockSection>

                    
             
  
        </apex:pageBlock>
        
        </apex:form>

</apex:page>

 

  • October 25, 2011
  • Like
  • 0