We have a process model which gets triggered by two different role users for same data . Both of them executes the process model with a split of second gap. Due to this, the first time process model will be running and second time also gets triggered for the same data, as the first one completes the second time process model fails and we have configured mails getting triggered for failed process model, so generating mails.
Do we have a way where when process model is running for a certain data and second user triggering the same process model for same data should not get error or second time the process model for same data should not get triggered.
You can create a process report and use a!queryProcessAnalytics() that gives active processes and the process variable data that is present in them. Use this information to avoid invoking new process if active process with same data exists.
I think I know what is happening. You have process coming into a sub-process node that runs twice, and 2 synchronous processes that when they end go to the end node (they may have a few automated tasks in between subprocess and end node)? Does that section of your PM look something like this crude ascii art?:
---[ ,, ]-------------O
If that's your issue, you have 2 solutions.
1. You can configure the MNI to not move on until all instances are done.
2. Preferred because it's more explicit and readable: use an AND gateway to split the process flow in half, use 2 separate sub-process nodes that call the same process synchronously once each, one for one role and the other for the other role, and the outflows from those joined by another AND gateway. The AND gateway is forced to wait until both complete before it proceeds.
Either method will prevent the parent process from completing after one is done killing the slower one midway through, but requires both to be completed before terminating the parent process.
If it's at all possible to choose asynchronous instead, that would be preferable for the sake of your execution engines and likely also solve your problem.
I am guessing that the process is an action instead of a task that is assigned to a group (as if it was a task, the first person to pick it up would take ownership). So, here are some design considerations to try to lessen the risk of a race condition.
1. Set a DB values (flag) and a check of the flag (and 'owner') as the first step in the PM to indicate a 'lock'
2. Execute any queries on the SAIL form through a view, that only brings back data not 'locked' by the current user
3. 'Unlock' through timeout exception flows and process completion to open things back up
Hope that at least gives you some ideas to play with
Discussion posts and replies are publicly visible
© 2019 Appian. All rights reserved.