How to refresh/synchronize dataGrid after executeMicroflowInBackground?

Hello, In this scenario when the user creates a new object in a dataGrid on the overview page, it takes the user to the Edit page. When they are ready to create, they will hit the Save button, which will call a microflow. This microflow does two things: a show page action to show the overview page and calls the executeMicroflowInBackground java action in the CommunityCommons module to run another microflow. In the background, this microflow will create the new object in the Mendix database and also upload its data to an external database, which usually takes around 15 seconds. I have set the dataGrid to refresh after 15 seconds, after which the user will see the new row appear in the dataGrid without having the page refresh (remember, the user was navigated to the overview page when they click the save button).  Here’s the issue: Without refreshing the page from the scenario above, if the user goes to edit that same object that they just created and click the Save button after they are done editing, the microflow will call once again. But, when I go to commit the changes to the database, it thinks that the object doesn’t exist and then throws a unique constraint or index violation error. Full error below. How do I prevent this from happening?   I have ideas to possibly force a page refresh once they first create the new object, but when I try running a Javascript Snippet to refresh the page (window.location.reload()), it just brings me back to my home page of the app. I was also thinking maybe to synchronize the database somehow during the microflow after I commit the object, but I don’t know how to do that. Any help is appreciated. Thanks.   Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: Duplicate column value violates its unique constraint: integrity constraint violation: unique constraint or index violation; SYS_PK_10316 table: "transaction$transactionidentification" (SQL State: 23505, Error Code: -104) Detail Message: org.hsqldb.HsqlException: integrity constraint violation: unique constraint or index violation; SYS_PK_10316 table: "transaction$transactionidentification" at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(  
1 answers

I am not sure if it will work but we have the follow pattern:

1. On your overview page, put a MF timer widget, which is triggered every so many seconds (5 sec in ours case).
2. The MF triggered checks if there is a refresh object available and if so, refreshes the main object, refreshing the entire page:


If you do not have a page entity, you could let the microflow close the page and reopen it. Although it might give a less smooth user experience, I expect it should do the trick.