I am working on a link task where the user wants to ‘import’ data from one table to another
Purchase orders can be generated through a purchase needs table. The purchase order table consists of purchase order lines. The user also wants the possibility to import purchase needs into an existing purchase order. I set up the following process flows:
Process Flow 1
- The user clicks on the link task located in the purchase order line. The purchase_order_id is one of the task parameters.
- The purchase needs table is opened (as a floating document) with the necessary active filters. Only active purchase needs with the same supplier as the purchase order’s supplier are shown.
- A hidden column ‘link_purchase_order_id’ in the purchase_need is filled with the purchase_order_id. This is done in a decision process action.
Process flow 2
- The user must be able to select multiple rows in the purchase need table.
- A decision performs an update and empties the ‘link_purchase_order_id’ of all unselected rows.
- The selected rows are inserted into the purchase_order_line table and the necessary purchase_order_id is retrieved through the ‘link_purchase_order_id’ column.
This however does not seem as best practice. Since the process can be disturbed when users start performing these actions simultaneously with the same supplier.
Is there a possibility to ‘save’ the purchase_order_id or send it to another process flow?
In 2023.2 you can use optimistic locking to prevent behavior like this.
For older versions you could reserve the rows by setting the purchase_order_id in the needs table as a "lock” and use a trigger to check if the lock corresponds with the action you are trying to perform.
Thank you. We’ll make sure to check the optimistic locking when we start using 2023.2.
For now I’ve linked the purchase_order_id to the employee (table) instead of updating the purchase need table every time the task is started. Therefore the purchase order id in the purchase need cannot be overwritten by another user if they start the task simultaneously.