Are database commits executed at the end of the main microflow or also at the end of a submicroflow?

0
Hi,   I always assumed that a database commit is executed at the end of the main microflow, but I have created a test case where this doesn't appear to be true. Mx 10.3.1.   1. Commit in main microflow. Consider an object with a boolean attribute. The initial value is false. The first actions sets the boolean to true and commits and refreshes the object. The second action changes the boolean to false. The resulting database value of the boolean is false. This works as expected.   2. Commit in sub flow. I have moved the first change action to a sub microflow. The resulting database value of the boolean is now true. This I did not expect. In the runtime, the boolean is shown as false. But the database value is true (I have checked this by performing a database retrieve and by performing a rollback action). I always assumed the most recent state of the object was committed to the database once the main flow is finished. But from this test I have to conclude that the database commit is finished at the end of the sub microflow and any subsequent changes in the main microflow are not committed. Can anyone explain this behaviour? Is this normal?   Thanks!
asked
1 answers
0

I reproduced your testcase in Mx 10.3.1 and the results are not like you describe.

In the case where the change with commit changes the boolean to true and this is followed by the change to false without commit, the result is that the database value is set to true (not to false).

The same result is adchieved when using the sub microflow case. 

This woould be logical as in both cases the transaction is started at the begining of the triggered microflow and ended at the endpoitn of the triggered microflow. In the transaction there is just one commit in either case that will persist the true value to the database. The change to false is not committed to the database in the transaction and thus the result is as expected that the database value is ttrue for both cases. The commiits are not deferred to the end of the transaction. You should view the microflow including submicroflows as a transaction and the actions are all perfromed inside the transaction. The persisting to the database is deferred to the end of the transaction and dureing the transaction the changed values are available inside the transaction, only when committing the value is stored in the database when the transaction has finished. This causes the result of both cases to be that the boolean is set to true.

answered