How to update multiple tables with order

I have 1 table SalesOrder, and 1 child Table SalesOrderDetail. And 1 Table as StockInventory to add/minus all Items, event to update StockInventory will be call by Bot when status in SalesOrder changed to Done with related data in SalesOrderDetail.

If I create 1 SalesOrder with 1 item in SalesOrderDetail, and after that I create new 1 item in SalesOrderDetail and update status in SalesOrder to Done also. The event to call Bot to update StockInventory must be run after all data of SalesOrderDetail inserted/updated.

But It always run not in order. It's means data in SalesOrderDetail not fully updated but Bot already call the Event to update StockInventory

0 1 111
1 REPLY 1


@duytv254 wrote:

The event to call Bot to update StockInventory must be run after all data of SalesOrderDetail inserted/updated.


Normally, there is a single Inventory item in each SalesOrderDetail row.  Is that not the case for you?

If it is, then you can call your Inventory update actions on each SalesOrderDetail row Add/Update.  Each Inventory update should be independent of the others. You don't have to wait for all of them to be added.

 

Top Labels in this Space