Let's say I have a CRUD script that does some actions for OnCreate/OnUpdate/OnDelete.
If that script fails for any of the action, I would like to rollback the changes to the DOMInstance.
In this cases I'm considering the creation of the instance and the execution of the script as a single transaction
Could I work with a DomBehaviorDefinition where each state represents a part of the transaction?
Hi Tim,
What Jens suggested could be an easy approach to get the intended behavior. Do keep in mind that this could introduce an infinite loop.
In general, I would not recommend an approach where a DOM instance is rolled back to a previous version using CRUD scripts. The exact use-case is not exactly clear from the original question, but if you would have some configuration that you define on a DOM instance, which could be 'denied' or result in a failure, I would opt to use a state system as you already mentioned. Some flow where the DOM instance moves to. "Initial" -> "To Accept" -> "Accepted". But if the configuration causes a failure, it will move from "To Accept" to "Failed". A user can then change the DOM instance and move it back to "To Accept" to try again.
Ideally, you would not even use CRUD scripts but do this validation but do it in de scripts that do the status transitions. Let me know if you want to sync on the best approach for your use case.
Scheduled in a meeting for Monday, thanks