
1)If the product line for the product selected in opportunity items is equal to ‘ DIE’ make following changes .
a) unit price should change to $0.01.
b)Extension =Qty*0.01
c)Subtotal =(Non_pick_total)
But Extension is formula field which is (Extension=qty*1) and
Non_pick_total is a Roll up summary field which Aggregates the Extension.
The issue is the "Extension" field value is getting calculated based on the formula field but it should get calculated as per the changes made in visual force page and display (Extension =Qty*0.01) on the subtotal .
Code :
if(OPplineitem[i].PricebookEntry.Product2.Product_Line__c=='DIE')
{
tempObj.unitprice=0.01;
tempobj.extension=OPplineitem[i].Quantity * tempObj.unitprice;
tempObj.productname=OPplineitem[i].Bin_Item_Code__c;
tempObj.Subtotal =opportunity.Non_Pick_Total__c*tempObj.unitprice;
}
else
{
tempObj.unitprice=1;
//tempObj.unitprice=OPplineitem[i].ListPrice;
tempobj.extension=OPplineitem[i].Extension__c;
}
I Get Error As :Arithmetic expressions must use numeric arguments at line
tempObj.Subtotal =opportunity.Non_Pick_Total__c*tempObj.unitprice;
Subtotal and Non_Pick_Total__c are Roll-Up Summary (SUM Opportunity Product ) and UnitPrice is a Currency data type
Any help very much appreciated
This forum is mainly based on configuration and native capabilities. You might have better luck taking this coding question to the developer forum or the Salesfroce Stack Exchange forum. They are more geared towards coding questions.
https://developer.salesforce.com/forums
http://salesforce.stackexchange.com/