What is the best and most efficient way to display values from a newly created record within the flow?
I have been assigning values to a record variable throughout the flow. Then I'll use that record variable to create the record. More often than not, I'll need to display some of those fields on a success screen shortly thereafter. However, when I try to immediately reference that record variable and the fields that were used to create the record, those fields are inaccessible.
The only fix that I've found for this is to immediately use a Get element to retrieve that record by ID. This seems painful to do since I know what the values were when the record was created. Why can I not reference them? Is this GET really required to get at the values of the fields on that just created record?
Also, thinking about the larger picture here, adding another Get element also increases the SQL queries within that transaction for something that you should have already. I'm thinking that there has to be a better way to do this and I would love to eliminate having to take this additional step.
This applies to things within the same flow as well as when I pass this record variable into a subflow and expect to receive that record back as input.
Isn't there a better way to do this?
Davis Johnson (SolomonEdwards) Forum Ambassador
If I understand the use case correctly, I think you can take a different approach here. The idea would be to run a single DML (e.g. get ALL record types for the object), and then use a Collection Filter (which does not count against DML) to search your collection from your original Get Records element. Essentially, we want to just get a table of everything it could be 1 time, and then search that existing table multiple times (instead of searching for what you know it's going to be multiple times, running up your DML count). A somewhat fitting analogy might be that instead of ripping pages we need out of the dictionary 1 by 1, we want to bring the whole dictionary over and reference it multiple times.
Let me know if you want me to present some screenshots of the two methodologies as that might be able to clear up some confusion too!