Record Validation - Update View After Failed Record

I’m trying to setup record validation and one behavior I noticed was something to do with the failed records.

So after an error occurs, the record gets put into the failedRecord queue right? In the actual database the record is fine. However, the view in the NG client still shows the failedRecord for the user.

Why is that? Is there a way to not show the failedRecord and just revert back to normal, well atleast for the users point of view. Does it have something to do with how the failedRecord queue works, or perhaps the foundset of the form not refreshing?

Is this with the new-style validation in Servoy 2020.12?

Hi John,

All records track their changes, keeping both the old value and the new value.
When a save fails, the default behavior doesn’t revert the record. The record is, as it was before the save, and Servoy doesn’t assume that you want to revert anything.

Failed records can be reverted programmatically, for example:

if(!databaseManager.saveData()){
    plugins.dialogs.showErrorDialog('Save Failed');
    databaseManager.revertEditedRecords();
}

I hope this helps. if not, please share more about the desired UX.

Best,
Sean

sean:
Hi John,

All records track their changes, keeping both the old value and the new value.
When a save fails, the default behavior doesn’t revert the record. The record is, as it was before the save, and Servoy doesn’t assume that you want to revert anything.

Failed records can be reverted programmatically, for example:

if(!databaseManager.saveData()){
plugins.dialogs.showErrorDialog('Save Failed');
databaseManager.revertEditedRecords();

}




I hope this helps. if not, please share more about the desired UX.

Best,
Sean

Thank you Sean!

I’m not using manual saving, just the AutoSave. Thus, I put,

databaseManager.revertEditedRecords();

into ‘onAutoSaveFailed’.

Now whenever there’s an error, the record foundset now gets reverted back. Just like I wanted, thank you!

This also seemed to fix another issue I was having where since before the failed record didn’t leave the foundset, the failed record would break the NG grid (it would only show the failed record on the grid).

I’ll post again if anymore issues arise.