July 6, 20196 yr Newbies Hi, I started this project using transaction to interact with the data, I used the transaction module from KarbonFM to do so. I have a situation where one of the script called during the transaction fails because it want to validate that a record exists before doing what it has to do. Because the said record is created as part of the same transaction, the script does not 'see' the newly created record via the relationship because it is not committed yet. Is there any way around that? Thanks for your help
July 7, 20196 yr For the sake of readers here, I'll also post my response here: Quote Two options. Commit before you go to the other script. Solid error checking negates the need to validate that the record is there. If the record is in the process of being created, and does not fail, you can assume the record is there. If you are using that script from other scripts where it is expected the record is already there, you can either move the validation to before you call the transaction ( make sure everything is in place first before you execute the script ) or fork the script to account for the two different flows. Depends a lot on how you are developing. Semi-quote with some updates because of context: Quote Getting the most out of transactions comes down to pulling out the reusable pieces, and separating them into their own script. The process of editing a record is really the same most of the time. The only differences will usually be the actual data, and which fields are being set. So handle the business logic before you send it to the script that actually sets the data or creates the records.
July 7, 20196 yr Author Newbies @Josh Ormond Thank you, I know we exchanged on this topic elsewhere, but taking the time to recap essential elements here as well for the benefit of as many people as possible is outstanding dedication. "Mille fois merci!"
Create an account or sign in to comment