Question

How to set Discount on Sales Order programmatically

  • 10 June 2021
  • 0 replies
  • 23 views

Badge

For a newly created Sales Order I want to add positiv or negativ discounds, on document and line level.

Discounts by percentage work find. On document level I create a new SOOrderDiscountDetail, set Type = ‘B’, IsManual = true and DiscountPct. On line level I just set SOLine.DiscPct.

But I have problems to set discounts by amount. If I set SOOrderDiscountDetail.DiscountAmt or SOLine.DiscAmt, it is set back to 0,0.

The lines and discount details are created any persisted like this.

SOOrderEntry.Transactions.Insert(new SOLine{...});

SOOrderEntry.DiscountDetails.Insert(new SOOrderDiscountDetail{...});

SOOrdeEntry.Actions.PressSave();

 

What is the correct way to set a discount amount on document and line level code?


0 replies

Be the first to reply!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved