I have a salesforce flow that is an invoked flow from a button click on a list.
- After clicking the button, I send the ID of the parent record to the flow, and get all the child records with a get records element.
- This could be anywhere from a single record to possible hundreds or even thousands of records.
- I then perform a lot of validation on the child records. The specific type of logic I am doing is irrelevant, but I do have to loop over the child record set several times.
- Since there is a possibility of so many child records, I call a pause element after this initial logic, before proceeding with the rest of my flow (to reset governor limits - it is set to proceed in 0 hours, which continues the flow almost immediately instead of after an hour long pause).
- The original issue was that when I was using a pause element, I got the error "The interview is too large to be saved." Again, I am looping over a large set of records several times, and have decision paths in each loop.
- So my solution to prevent the pause element from having to save so many elements was to break this initial set of logic off into a sub-flow. Here is the original flow:
And here is the subflow I am calling:
In the first flow, the 'Copy 1 of Pause...' pause element is where the flow is failing with the above mentioned error. I would have thought after breaking off all the beginning logic and flow elements into a dedicated subflow, the pause element wouldn't have anything except the single subflow element to save?
So, why am I continuing to get this error?
- Is it possible that the pause element is referencing the contents of the subflow, and not just the subflow element itself? (I don't need to persist anything that happens in the subflow, because I am updating the child records in the sub flow, then retrieving them again later in my main flow.)
- Is there some way to call the pause (for purposes of resetting the governor limits) without causing the pause to have to save the flow interview?
Also, if there is no way around this, I was thinking of replacing the subflow with a large apex class that does everything just as the subflow does. Would this help, or would the apex class be just as large as the subflow, therefore causing the same error when the pause element goes to save it?