Question

Using Commit method in Activity for flows

Why is it not a best practice to use a commit method or (Obj-Save with Write now) in Activities that are referenced in flows?

Correct Answer
February 6, 2018 - 10:44am

Hi Bhargav,

Its because to avoid the data integrity issues as explained in the below documentation,

https://pdn.pega.com/how-correct-commit-warning-activity-rules/how-correct-commit-warning-activity-rules

Hope this might answer your query.

Regards

Mahesh

Comments

Keep up to date on this post and subscribe to comments

February 6, 2018 - 10:44am

Hi Bhargav,

Its because to avoid the data integrity issues as explained in the below documentation,

https://pdn.pega.com/how-correct-commit-warning-activity-rules/how-correct-commit-warning-activity-rules

Hope this might answer your query.

Regards

Mahesh

February 7, 2018 - 2:37am
Response to Mahesh Midthuru

Hi Mahesh,

Thanks for the response. Since the flow processing already already commits the work object, it may cause data synchronization problems in database if we explicitly use the commit.

So, as far as i understood, it is the best practice to use commit method only if the activity is referred outside a flow, like Utility,Button Actions...?

regards,

Bhargav

 

 

February 7, 2018 - 3:27am
Response to BhargavS

Yes, you can use the commit method in activity only when you are calling this activity from a rule which doesn't have the explicit handling of commits.

February 7, 2018 - 5:04am
Response to Mahesh Midthuru

Thank you Mahesh for the Response. That was helpful.

regards,

Bhargav

December 11, 2018 - 8:05am

Hi Bhargav,

Using of "Commit" method will expilictly save the data into the database.
As a best practice Commit method can be used when we use multiple Obj-Save methods in an activity. 
For Ex: I have five Obj-save methods in an activity, I dnt want to save data with each Obj-Save method, but I want to save the data after execution of all 5 Obj-save methods. For this scenario, I will simply have 5 Obj-Save methods without checking "WriteNow" and I will use "Commit" method after the all the Obj-save methods within that Activity.

We can also avoid using "Commit" method if we dont want the data to be saved into DB immmediately.

Please find the screenshot attached, may that gives you clear understanding.