You need to sign in to do that
Don't have an account?
MaheemSam
Multiple two values using visualforce page
Hi,
I have a requirement to edit opportunitylineitems using visualforce page I wrote below controller and visualforce page but it is not working as expected please suggest what is the issue in the code. I am using apex : action support method but it is not working please suggest
Controller
I have a requirement to edit opportunitylineitems using visualforce page I wrote below controller and visualforce page but it is not working as expected please suggest what is the issue in the code. I am using apex : action support method but it is not working please suggest
Controller
public with sharing class OptyLineEditCnt{ public ApexPages.StandardController sc; public Opportunity Opp {get;set;} public List<OpportunityLineItem> OLIlist2 {get ;set;} public integer text3{get;set;} public integer qty{get;set;} public integer unt{get;set;} public OptyLineEditCnt(ApexPages.StandardController sc) { this.Opp = (Opportunity)sc.getRecord(); OLIlist2 = [Select name,ID, Quantity, OpportunityId,PricebookEntry.name,UnitPrice,listprice,TotalPrice,Discount_rate__c,Reseller_discount_rate__c,ProductCode, Product2Id FROM OpportunityLineItem WHERE OpportunityId =:Opp.Id]; } public List<OpportunityLineItem> getOLIs() { List<OpportunityLineItem> OLIlist2 = [Select name,ID, Quantity, OpportunityId,PricebookEntry.name,UnitPrice,listprice,TotalPrice,Discount_rate__c,Reseller_discount_rate__c,ProductCode, Product2Id FROM OpportunityLineItem WHERE OpportunityId = '00634000012hmEG' ]; //:Opp.Id return OLIlist2; } public void calculate() { Decimal totalprice; text3 = qty * unt; } public pageReference calculate1() { //try // { calculate(); // } // catch (NullPointerException ex) { // System.debug('Exception'); // } return null; } public PageReference saveIt() { update OLIlist2; return null; } }Visual Force
<apex:page standardController="Opportunity" extensions="OptyLineEditCnt"> <apex:form > <apex:outputPanel id="test"> <apex:pageBlock title="Opportunity Products"> <apex:pageBlockTable var="OLI" value="{!OLIs}" id="newProduct" columnsWidth="50%"> <apex:column headerValue="Quantity"> <apex:inputText id="Quantity" value="{!OLI.Quantity}"/> </apex:column> <apex:column headerValue="Sale Price"> <apex:inputText id="Unitprice" value="{!OLI.UnitPrice}"/> </apex:column> <apex:column headerValue="Final Price"> <apex:inputText id="Finalprice" value="{!text3}"> <apex:actionSupport event="onmouseover" action="{!calculate1}" reRender="test"/> <apex:param id="qtyid" name="qtyid" value="{!OLI.Quantity}" assignTo="{!qty}"/> <apex:param id="untid" name="untid" value="{!OLI.UnitPrice}" assignTo="{!unt}"/> </apex:inputText> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:outputPanel> </apex:form> </apex:page>
I am getting below error message in the controller what might be the issue here please suggest
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!calculate1}' in page testaction: Class.OptyLineEditCnt.calculate: line 34, column 1
Class.OptyLineEditCnt.calculate1: line 43, column 1
Class.OptyLineEditCnt.calculate: line 34, column 1
Class.OptyLineEditCnt.calculate1: line 43, column 1