Hi,
Just looking for some advice or input. When we know in a standard class it has function that in the middle of the process we want to modify it. Is that possible and how ?
To be precise, the issue I found is in a class named : RevRecCustPostInvoiceDeferredNew, in their function named : createDeferredLinesForInvoice(), if by any chance the line is same, I will be directing to Line 1059
it has this code :
if (RevRecUtil::findDiscountAccountForSalesOrder(salesLineBuffer)) { netDeferredLine.LineAmount = _custInvoiceTrans.SalesPrice * _custInvoiceTrans.Qty; } else { netDeferredLine.LineAmount = _custInvoiceTrans.LineAmount; }
Problem I found is with the netDeferredLine.LineAmount, as in "why the system need to check it has main account for Discount" ? I cannot find a good reason of checking this but this checking makes LineAmount in CustInvoiceTrans being calculate by multiplying SalesPrice & Qty, not following what already stated in LineAmount.
Unless my investigation is wrong, but if I'm using Price Include Sales Tax, the LineAmount which already excluded tax will be wrong again since Sales Price in this field still included tax.
In SQL, the CustInvoiceTrans will be like this ->
And the point to my question is, this is in the middle of the method processing and after these code, the Line Amount will be used for other calculation as well, still inside the same method/function. So if I want to lets say modify it, lets say to ignore the Discount main account checking, how am I going to do that ?
Thanks,
Hi Girish,
You mean writing the same process in my CoC, and modify the middle part ? I think this is very risky not to mentioned what you saying of tedious and time consuming.
I'd like more on the "onInsertingEventHandler", Thanks for suggesting. Let me try first.
Hi VoltesDev,
After the completion of the process, they are inserting the records into "RevRecDeferredLine" table. So, you need to either write COC for the method createDeferredLinesForInvoice and you need to find a way to update the record in "RevRecDeferredLine". But keep in mind that they are using RecordInsertList to insert records into "RevRecDeferredLine" table. In that method they are using the for loop to loop the lines based on the "numberOfScheduledLines" buffer. So, you need to do same process in COC which will be tedious and time consuming.
If it doesn't work, you can write onInsertingEventHandler for table "RevRecDeferredLine " to somehow find a way to set the desired values before inserting values into table.
Thanks,
Girish S.
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156