When using the action framework to save models, it is possible to select multiple models to be saved. There's an option to specify that the entire operation should be rolled back if there are any errors. This can be used to prevent records being created if later operations fail.
For example: imagine a page where you enter a new account, and new contacts related to that new account in one page. You set up an action that saves both models, and the Account is saved, and the Contact is saved and linked to the account. Let's say that for some reason the Contact save fails - let's say a validation rule fires. If the rollback option is checked, that will prevent the Account from being created as well.
Is there a way to do this when using the Javascript API? I may be looking in the wrong place, but the closest I can see is skuid.model.save() which takes a function that is called when the save finishes. The problem with this is that the function is only told what succeeded and what failed; it doesn't roll back. Feasibly, at this point you could try and delete records, but it's possible that the user has create/edit but does not have delete for the object that needs to be deleted.
Anybody had any thoughts about this?
For example: imagine a page where you enter a new account, and new contacts related to that new account in one page. You set up an action that saves both models, and the Account is saved, and the Contact is saved and linked to the account. Let's say that for some reason the Contact save fails - let's say a validation rule fires. If the rollback option is checked, that will prevent the Account from being created as well.
Is there a way to do this when using the Javascript API? I may be looking in the wrong place, but the closest I can see is skuid.model.save() which takes a function that is called when the save finishes. The problem with this is that the function is only told what succeeded and what failed; it doesn't roll back. Feasibly, at this point you could try and delete records, but it's possible that the user has create/edit but does not have delete for the object that needs to be deleted.
Anybody had any thoughts about this?