AnsweredAssumed Answered

Lock/Unlock objects due process workflow

Question asked by edsonrichter on Jun 6, 2016
Latest reply on Jun 20, 2016 by jbarrez
Hi!

I would like to know if there is any best practice reccomendation to lock/unlock objects involved in an workflow.
Let's say, I choose several orders that need to be cancelled.
The cancel process involves review the chosen orders, and then a sales manager to confirm cancellation.
Meanwhile, I would like to avoid anyone else to change the orders until the process is finished, manually cancelled or timed out.

Some ideas come to my mind:
1) I need to have a "lock table" since workflows must survive restarts of the app server. I suppose I need to record the process instance ID into this table, so I can track objects x processes and destroy process in case of forced unlock (item 2 ahead).
2) I need some way to unlock objects for a long while - and forcing the unlock must manually cancel the process itself.
3) Is better to lock objects from inside the process itself (for instance, after the objects review task), or is better to lock them before starting the process instance?
4) The event of error must call a task to unlock all objects?
5) Is there any generic "process listener" or "process instance listener" which I can use to lock and unlock objects (even in case of catastrofic failure)?

There are best practices which I can learn from about this topic?

Thanks,

Edson Richter

Outcomes