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
venkatasubhashkvenkatasubhashk 

values not saving from controller

hi

 

 i am unable to save stagename when saved,but closedate if i change its getting saved...

 

public class Oppctrl
{

  


   


    public PageReference save() {
    
        update opps;
       
     update oppli;
   
  return null;
   
    }
    
public Opportunity Op ;
public Opportunity[] Opps ;
public OpportunitylineItem[] Oppli ;
public OpportunitylineItem[] Oli ;


 
public Oppctrl()
{

this.id =ApexPages.currentPage().getParameters().get('id');
op =[select id,name,Total_Invoiced__c,Total_Planned__c,Total_Submitted__c,ownerid,Purchase_order__c,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where id=:id];
oli = [select id,Quantity,delete__c ,pricebookentry.name,UnitPrice,Opportunityid,Quote_Original_List_Price__c,Product_Code__c   from OpportunityLineItem where opportunityid=:id];
opps =[select id,ownerid,name,Account.name,stagename,CloseDate,amount,probability,Header_Opportunity__c,Accountid,Opp_Line_Items_Count__c,Billing_Contact__c,No_Of_Months_for_Billing__c from Opportunity where Header_Opportunity__c =:id];

oppli = [select id,Line_Item_Total__c ,Quantity,delete__c ,description,UnitPrice,Opportunityid,Quote_Original_List_Price__c,Product_Code__c   from OpportunityLineItem where opportunityid in: opps];
//oppli = [select id,Quantity,UnitPrice,Opportunityid,Quote_Original_List_Price__c,Product_Code__c   from OpportunityLineItem where opportunityid in:opps or Product_Code__c =: opps[0].name];

}
public String getname()
{
return 'Oppctrl';
}
public Opportunity getop()
{
return op;
}

public Opportunity [] getopps()
{
return opps;
}

public OpportunitylineItem[] getoppli()
{

return oppli;
}
public OpportunitylineItem[] getoli()
{

return oli;
}


}

 

<apex:page controller="Oppctrl" sidebar="false">
 
<apex:form >

<apex:pageMessages />
<apex:pageBlock title="Manage Billings">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>

</apex:pageBlockButtons>



<table border='0' style="empty-cells: hide" align='left' >


<tr bgcolor='#C0C0C0 '>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
<tr>
<td></td>
<td><b> Opportunity Owner </b></td>
<td><apex:outputField value=" {!op.ownerid}"/></td>
<td><b> Total </b></td>
<td>  
   
<apex:outputPanel id="gt">
 <!--<apex:outputText value="val:{!gtotal}"/> -->
<apex:outputText value="{!gtotal}"/>
</apex:outputPanel>

      </td>   
</tr>

<tr>
<td></td>
<td><b>Opportunity Name</b></td>
<!--<td><apex:outputField value="{!op.Name}"/></td> -->
<td><apex:outputLink value="/{!op.id}" target="_blank">{!op.name}</apex:outputLink></td>
<td><b>Planned</b></td>
<!--<td>{!op.Total_Planned__c}</td>-->

<td>
NULL
</td>

</tr>

<tr>
<td></td>
<td><b>Account</b></td>
<td><apex:outputField value="{!op.Accountid}"/></td>
<td><b>Submitted</b></td>
<td>{!op.Total_Submitted__c}</td>
</tr>

<tr>
<td></td>
<td><b>Billing Contact</b></td>
<td><apex:outputField value="{!op.Billing_Contact__c}"/></td>
<td><b>Invoiced</b></td>
<td>{!op.Total_Invoiced__c}</td>
</tr>

<tr>
<td></td>
<td><b>Purchase Order</b></td>
<td><apex:outputField value="{!op.Purchase_order__c}"/></td>
<td><b>Difference</b></td>
<td>Difference</td>
</tr>

<tr>
<td></td>

<td></td>
<td></td>
</tr>
<tr><td></td></tr>
<tr>

<th></th>
<th bgcolor='#C0C0C0 '>Product</th>
<th bgcolor='#C0C0C0 '>Unit Price</th>
<th bgcolor='#C0C0C0 '>Quantity</th>
<th></th>


<th></th>
</tr>
<apex:repeat value="{!oli}" var="l">
<tr>
<td>
</td>
<td><apex:outputField value="{!l.Pricebookentry.name}"/></td>
<td><apex:outputField value="{!l.unitprice}"/></td>
<td><apex:outputField value="{!l.quantity}"/></td>
</tr>
</apex:repeat>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>

<tr>
<apex:repeat value="{!opps}" var="q">
<tr bgcolor='#E0FFFF'>

<th>Opportunity Name</th>
<!--<th>Header Opportunity</th>-->
<th>Stage</th>
<!--<th>Account</th>-->
<th>Closedate</th>

<th>Amount</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>

<td><b><apex:outputField value=" {!q.name}"/></b></td>
<!-- <td> <apex:inputField value=" {!q.Header_Opportunity__c}"/> </td> -->
<td> <apex:inputfield value=" {!q.stagename}"/> 
 

</td>

<td> <apex:inputField value="{!q.CloseDate}"/> 

</td> 


<td>action support</td>

<tr bgcolor='#E0FFFF'>

<th></th>
<th>Delete</th>
<th>Product</th>
<th>Unit Price</th>
<th>Quantity</th>
<th>Description</th>

<th></th>
 <th></th> <th></th>
</tr>


<apex:repeat value="{!oppli}" var="qa" >
 <apex:outputPanel rendered="{!IF((qa.Opportunityid == q.id),true,false)}">
 <!-- <apex:repeat value="{!oppli}" var="qa" rendered="{if (oppli.Opportunityid == opps.id),true,false}"> -->
<tr>
<td>
</td>
<td>
<apex:inputField value="{!qa.Delete__c}"/>
</td>

<td><apex:outputField value="{!qa.Product_Code__c}"/></td>
<td><apex:inputField value="{!qa.unitprice}"/></td>




<td><apex:inputField value="{!qa.quantity}">
<apex:actionSupport event="onchange" action="{!grandtotal}" rerender="gt"  status="wait"/>
<apex:actionStatus id="wait" startText=" (pls wait...)"/> 
<apex:actionSupport event="onmousemove" action="{!incrementCounter}" rerender="counter"  status="wait1"/>
<apex:actionStatus id="wait1" startText="(pls wait individual...)"/> 
</apex:inputField>

 </td>
<td>
<apex:outputField value="{!qa.description}"/>
</td>

<td>

<apex:inputCheckBox value="{!qa.Delete__c}" id="primaryCheckBox" disabled="{!NOT(qa.Delete__c)}" onclick="deSelectOthers(this)" />
</td>

<td>
<apex:outputPanel id="counter">
<apex:outputText value="Calc!:{!countindvidual}"/>
</apex:outputPanel>



</td>





</tr>
</apex:outputpanel>
</apex:repeat>




</apex:repeat>

</tr>

</table>
     

</apex:pageBlock> 

</apex:form>
</apex:page>

 when i hit save the changed closedate on visualforce is saved on record but stagename is not changed

 

i have opportunity lookup on Opportunity..