Prevent action in the "Then" of a "Open dialog" when canceling

So I saw that the action "Open Dialog" has a "Then" part, which is triggered when that dialog has been closed.

This is very good, but I was hoping that on Close of the dialog, I would know if the user closed it by cancelling, or it got closed after a successful action.

But apperently, the "Then" will fire regardless if the Dialog has been closed with "Cancel" or not.

In my example, when adding a new record, I open a dialog, and ONLY if the new record is successfully created, in the "Then" I have a new Invoke to reload the grid behind.
But if the user doesn't add a new record, I don't want that event to fire, because nothing has changed!

Is there a way?

You can set the Result of the Close dialog action. It will be available as ${result} in the Then event of the Open dialog. If it isn't set then the user closed the dialog otherwise. Use the Condition property to determine that.

ah I see, I wasn't using a "close dialog" action, as I didnt have a custom button to close the dialog, but was using the small "x" in the top-right corner!
Now it is clear, thank you