My goal is to change the calculation of line Amount on Sales Line by multiplying a custom field ‘NoOfMonths’ to the value of line amount. I have created an extension of SalesLine table and used the update() method to fulfill the requirement. Following is my code:
[Extensionof(tableStr(SalesLine))]
final class PRMSC_SalesLine_Extension
{
public void update(boolean _dropInvent,
Common _childBuffer,
boolean _updateOrderLineOfDeliverySchedule ,
boolean _mcrAutoallocate ,
boolean _cameFromCreate ,
boolean _promptSuppItem)
{
next update();
SalesLine saleLine;
if(this.ItemId == saleLine.ItemId)
{
saleLine.LineAmount = (saleLine.LineAmount) *
(saleLine.PRMSC_NoOfMonths);
}
}
Build and DB sync complete successfully. On debugging and changing any value on the front end of Sales Order, this error generates
SalesLine.update function has been called incorrectly
On debugging, this error comes on the next update() line.