Does the default Cancel button delete an object?

2
I have generated a NewEdit page from a data grid which comes with Save and Cancel buttons. Suppose there is a field on my NewEdit page set to Commit on Change. If I change that field, thus creating an object, then click Cancel on the form, is the created object deleted? Initial Thoughts If the answer is Yes, I'm all set. If the answer is No, then I think I will need to create a non-default cancel button with a microflow that deletes the created object. Context I have built my form in a snippet to promote UI consistency for two user groups, Technicians and Admins. Technicians generate data, so they are the ones who use the NewEdit page (in this case, a created object is called a Case). Admins review and edit entries (cases) made by Technicians. When reviewing a case, it makes the most sense for Admins to be able to have any adjustments to technicians' entries immediately committed, rather than having to click a Save button after making changes. Because the form is in a snippet, Commit on Change would be set for both users, potentially creating incomplete entries (bad data) in the database if a Technician ever starts a form but cancels before (s)he is finished. This scenario is avoided if the Cancel button on the NewEdit form deletes the object.
asked
1 answers
3

The cancel button technically doesn't delete anything: it performs a rollback which returns the object in question to the state it was in the last time it was committed. As a new object has no previous commits, it ceases to exist.

Now the cancel button isn't very smart. It has no idea where or how your object is saved. All it knows is that, when triggered, it should roll back. So the fact that your commit microflow is triggered in the same form as the cancel makes no difference, the commit still took place before the cancel event so your object will still exist after cancel.

The custom cancel activity is definitely a possible way to fix this. The downside to this approach is that it ignores the scenario where a user triggers your commit microflow but leaves the page without clicking cancel (e.g. by closing the browser). An alternative is to postpone any reference changes you want to make to a before commit microflow on the data view object.

answered