Flow issue with optimistic lock
A case is configured to use Optimistic lock. When two users are working on the same case and submit it simultaneously, error occurs. This is working correctly. However, if the second user opens a flow in a modal dialog instead of submitting the case, the case is saved without an error. This overrides the changes made to the case by the first user. This is an incorrect behavior.
Steps to Reproduce
- Create a case with a flow having a Split join with two assignments. Assign the case to two different operators.
- Configure the flow with an Optimistic lock.
- On the first assignment, in the screen, add a button such that it opens a flow in a modal dialog.
- Add a property of type text on the case to check the value when changing from both sides.
- Open the assignments from both users simultaneously.
- On the second assignment, the second user changes the property value in the text box and clicks Submit.
- The first user submits the assignment. An error is generated. This is expected behavior.
- Reopen each assignment on both the users.
- The second user changes values and clicks Submit.
- The first user clicks the button on the screen to open a flow in a modal, submit the modal, and submit the assignment. Error does not display and this version of the case is committed.
When a flow is executed, there is no check to determine if the work object is modified elsewhere. Once the flow is executed, the pxUpdateDateTime property is set with the current timestamp. Thus, pzShowConflicts activity does not return a conflict since it views this as the latest copy when compared with the one from the database.
Use the following workaround to address the problem:
- Configure another action item on click of a button to run the Work-.pzShowConflicts activity before the 'Flow in modal dialog' action.
- Perform either of the following based on the requirement:
- Create a section to use it as a modal template by performing a Save As or a section include of the pzModalFlowTemplate. Add a When condition to check if conflicts are present and display the modal dialog with or without the error message.
- Launch the modal dialog if no conflicts are found or refresh the case harness to display the error message.