Hi,
There is another way I came through during a recent implementation.
This method uses transaction ID to stop the transaction from executing in a parallel thread.
Logic::
1. Create a shared variable name it oldTransactionId with -1 as its default value.
2. Check if (Persistent.oldTransactionId < 0) and (Persistent.oldTransactionId < transactionid) , If true, its a new transaction .. go ahead process it.
2.1 .. Set the transactionid to the oldTransactionId shared property. The trasnactionId can be retrieved by using the keyword 'transactionid' in assignment action block.
2.2.. The last step of the transaction should be to set the oldTransactionId to -1 to ensure the execution happens in next try.
3. If false, then
3.1.. stop the transaction from executing. Because the older one is still running.
I have attached the snapshot of my sample trx, pause action is just to simulate longer duration.
Though it is very similar to the flag implementation, this method gives better visibility about which transaction is still running and which one is trying to access.
Thanks and Regards,
Tufale Ashai.