API Proper Field for Discount Amount

We have a need to pass over a discount dollar amount from a sales order submitted through our website. We have a custom plugin that passes the sales order values over API into Epicor.

I was storing the value in OrderHed.DocTotalDiscount field but it looks like that was not the correct field. I found OrderDtl.DocDiscount and am currently passing that value to line 1 for interfaced web sales orders.

The potential problem with that is the discount could be for $30 making line 1 -$20 if line 1 was a $5 part and line 2 was a $50 part. It seems like the discount should be dispersed among the lines or stored in a different field altogether.

Any input on this would be greatly appreciated!

From my traces, looks like it’s DocDspDiscount. You also need to call the ChangeDiscountAmount method after that.

You could try calculating the percent discount based on the total order amount, then set each with that percent, that should calculate out the total correctly applied across all the lines.