Custom amount field to append to the sales order total
Hello,
I would like to add a user entry currency field to the sales order header and would like that amount appended to the sales order total and remaining balance? Is there a way to do that in a view delegate so that the totals always accumulate correctly, or do I need to override the amount at every instance of recalculation of the order?
Thank you!
Page 1 / 1
You should be able to use the FieldUpdating for CuryOrderTotal to catch any changes being made to the total amount and include your custom field value.
@vineela95 Below is the code to calculate and automatically add the amount to the Sales Order Total field.
@Naveen Boga - I’m sure there’s a good reason, but I’m curious why you’re doing in ~50 lines of pretty complex code what can be done in ~10 lines of quite simple code.
Hi, @darylbowman "I implemented this quite some time ago and thoroughly tested all the scenarios, including the suggestions you mentioned earlier, but unfortunately, it didn't work for me.
Consequently, I/my team reached out to the Acumatica team and shared this sample. Could you kindly provide a concise code snippet, preferably under 10 lines, that fulfills this requirement? Your assistance will greatly benefit everyone here.
...but unfortunately, it didn't work for me.
Well, you made me doubt the thoroughness of my testings, so I did more testing.
Turns out, this doesn’t work correctly in all cases. I believe it would work correctly if the original Order Total field was kept and an additional total field was added which would reflect the changes to the original. But trying to do all of that in one field just doesn’t work that well.
Yes @darylbowman That’s right! It won’t work in on cases.
Therefore, I collaborated closely with the Acumatica team to ensure comprehensive support for every scenario, and after dedicated efforts, we successfully achieved functionality across all scenarios."
It actually worked surprisingly well in most situations that I tested. The problems arose when the lines totals changed by the same amount as the custom field amount. I couldn't figure out why even after several hours of testing
@Naveen Boga Thank you for the response. I tried your solution and I noticed that the totals are updating correctly, however, when I try to apply a payment against the order, I receive “The order cannot be applied, the specified combination of the order type and order number cannot be found in the system.” error. I remove that code and don’t receive the error. Very confused as to why this error is occurring.
Hi @vineela95 I've noticed a potential issue in the newer version that requires further investigation. I'll conduct a thorough analysis to verify and understand the root cause of the problem. I'll keep you informed of any findings related to this.
Hi @Naveen Boga - were you able find anything for @vineela95! Thank you!
Thank you @Naveen Boga !. Please let me know if you are able to find anything!
Hi @vineela95 I have checked it but seems like there is a change in the Base code in the new version. I request you to check with the Acumatica team and confirm this logic.
Thank you for your help on this @Naveen Boga !
Hi @vineela95 were you able to find a solution? Thank you!