There are quite a few excellent articles over the internet about taskflow transactions and Datacontrol instances, but i felt it would be great to explain the full cycle with diagramatic examples and scenarios where these features would be of great use. So lets start..
How Transaction and Application Module are related?
Each Application module holds one transaction at a time, below diagram gives a you a better picture of how it works in relation to App Module.
What is a DataControl Frame?
A DC Frame is a container which holds state of all associated Data controls. It may be confusing now, but you will get more clarity once we see an example.
Eg : Lets take 2 different taskflows "Employees" and "Departments", Both these Taskflows use same Application Module(this is very important), default settings and are used on same page.
This is how it works internally.
A Commit/RollBack anywhere in the DCFrame would update all DC changes to DataBase
i.e. Commit/Rollback in Employees taskflow will Commit/Rollback changes in Departments taskflow too.
Check out the below example with sample data.
As you can see, Both the taskflows have same DC Frames.
What are Data Control Scopes?
Now that we have a good understanding of how Datacontrol Frames work, Lets discuss about Data Control Scopes.
There are 2 different kinds of DC Scopes -
1) Shared (Default, It is what we saw in previous example).
2) Isolated.
Now what if we want to separate out the transactions i.e. if a commit in Departments taskflow should not affect Employees Taskflow?
We have an option in Taskflow level to separate out the DataControl Frames,
Go to Taskflow behaviour > Set the Transaction as "
Isolated"
So lets see how it works internally
Here is the example with sample data -
Note the DC frame, it is different for both taskflows.
A similar example can be explained for parent and child taskflows too. A solid understanding of datacontrol scopes will help understand the next post in this series.
I hope this helps:-)