How to add supplementary item in sales order line automatically using code


I have a supplementary item for sales order line.whenever create new line automatically add the supplementary item for current item in sales order line.


Have a look at SuppItemCreate* classes.

yes,but in that they are temp tables.

You can use the similar approach.
This is what they are doing in those classes,
Calculating the supplementary items related to that order, \Classes\SuppItemCreate\calcSuppItem
and inserting them into a temp table.
Loop the temp table and create sales lines. \Classes\SuppItemCreate\run

Thanks for your reply.
what value is assigning for Args argument.
passed this as value as args SuppItemCalc_Sales but getting errror like “Update must be called with parameter”

try using, mainOnserver.
But this give you prompt. Where you are using this code?

While creating line in sales order.


You already have the same on sales order line.
Sales order line (button) → Calculate → Supplementary items.

yes…donot want to click this button.whenever new line is created automatically supplementary item is added to
sales order line.

yes…ur crt.