Page 1 of 1

Line items force backordered via plugin

PostPosted: Tue Mar 15, 2022 10:10 pm
by Riyaz
Hi There

Is there a way to force the line items to go into back orders by making the quantity this delivery for that line item to be 0.

We are trying to do this via SalesOrderLine attribute as below but it wont reflect.

Line.QuantityBackOrdered = Line.QuantityOrdered;
Line.QuantityThisDelivery = 0;

Kindly advise

Re: Line items force backordered via plugin

PostPosted: Wed Mar 16, 2022 9:36 am
by SBarnes
That should work but without seeing the plugin in its entirety its hard to see why it's not working, the product also needs to be to back orderable obviously.

Re: Line items force backordered via plugin

PostPosted: Wed Mar 16, 2022 12:58 pm
by Riyaz
Hi Stuart

Pls find the plugin attached,

Re: Line items force backordered via plugin  Topic is solved

PostPosted: Wed Mar 16, 2022 1:46 pm
by SBarnes
The attached works in a Jiwa Demo database all I did was change your save end to a save start and removed the call to sales order save, which is probably a better way to do it as with what you had the order is being saved twice because save end is called after Jiwa has saved the order and then you are doing it again.

You could also put the code in the sales order line added and sales or changed events so the user sees that is going to back order before they save which might be a bit more user friendly but if you do you will probably need to detach and then reattach the events after the code fires so you don't have the event handler firing the same event on itself.