I have a page that saves three models when a button is clicked. The first model is just one record being created; the second (records being created) and third (records being updated) have many more. And more significantly, the second and third models have a lot of automation tied to them - mainly Processes and Flows.
All three models are saved within one action, and that action has the “Roll back save on any error” option checked. Because of the automation, I occasionally get a “Apex CPU time exceeded” error back from the server (this is visible in the Javascript console of the browser, and looks like it originates from the remoting call).
(Side ntoe: I do occasionally see other errors - I can’t remember which ones exactly, but I recall them being timeout type issues. I’d imagine this could be put down to a network problem, and that the operation succeeded on the server, but the client didn’t receive a response, so it’s a different issue. I only mention it for completeness 🙂
So with the CPU error, and the “Roll back” option set, what do you think happens with the data? I’d expect that none of the data is operated on - as Limit exceptions can’t be caught, I don’t expect Skuid to be able to be able to do too much in this scenario. However, when an error occurs, what I actually see is that some of the saves take place. For example, the second model’s records are created, but the third model’s records are not updated.
I’m as certain as can be that the Skuid front end is making one remoting call i.e. the backend handles all three model saves in one remoting call; when a CPU limit exception occurs, I’d expect all data updates to be rolled back by the platform, but that doesn’t appear to be what’s happening. If Skuid is somehow being smart (maybe in the back end there are checks against the limits and Skuid raises a custom exception - and that’s what I’m seeing in the JS console?), then the “Roll back” checkbox isn’t being respected, which it should be.
Just to be clear - I’m not asking about solving the Apex CPU error. I know the ways in which I can reduce the amount of time on the CPU and therefore reduce the chance of that error happening. I’m more interested in understanding what’s happening in the Skuid backend for this to happen as it does.
Look forward to hearing theories about this - thanks!
Question
Unexpected rollback behaviour
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
