How Does “Automatically Store All Fields” Option Work?

Some commenters on my recent LinkedIn benchmark post were asking about the performance of getting all fields automatically in a Flow’s “Get Records” action or getting only the fields needed. I commented that I’d expect that getting only the fields needed would be faster than getting all the fields, especially if there are a lot of fields on the Object. Another commenter said no Salesforce only actually grabs the fields needed even when “Store All Fields” is chosen except when the record(s) are passed to a sub-flow and this forum thread was referenced.

This led me to research how does the “Automaticlly store all fields” option in a “Get Records” element work. Before you continue, what do you think it does?

Research

A custom object was created with 500 custom text fields each with 255 characters. A screen flow was created with a single Get Records that had the “Automaticlly store all fields” selected and was set to get the first record found without any criteria.

Next, the “Debug” button was clicked and the flow was ran. This outputs the fields queried in the debug output which helps answer which fields will be queried or not.

The Debug Details show only the Id field was queried and not all the fields on the Object! This seems to imply that only the fields referenced in the flow will be queried. Let’s check that out. Next a formula field is added to the flow referencing two fields from the record:

The Debug was ran again and here’s the details:

Id, Text_1__c, and Text_2__c were the fields queried. This means that only the fields referenced in the flow are used!! That’s great to know but doesn’t align with my interpretation of “Automatically store all fields” which is it’ll store all the fields on your behalf.

After further research, “”Automatically store all fields” does fetch all an object’s fields if the record(s) is passed as input to a sub-flow or an apex action!

Salesforce Feedback

The current Get Record Documentation doesn’t specify at a more technical level how it works. That needs to be updated!

Renaming the “Automatically store all fields” option to “Automatically store all used fields” or something else would be even better and updating the documentation to specify what the option does is needed too.

If there are any other Flow options whose behavior does something different than you expected, please share in the comments below!

4 thoughts on “How Does “Automatically Store All Fields” Option Work?”

  1. That is so good to know! I’ve also been interpreting all as all! But it makes sense that SFDC wouldn’t want us to have that as an option. That makes that option the smart one to select, yes? What would be a use case for doing the option of selecting the columns manually?

    1. “Automatically store all fields” should be the default option to use.

      If the fields to select can’t be determined, then the fields should be specified. This would be the minority with not too many use cases. One example is a sub-flow which cause all the object fields to be queried when all fields is chosen. If you know which fields are needed by the sub-flow, query only what is needed but now you’ve created an implicit dependency between the two flows. It’s usually better to pass the record ids to sub-flows so they can query what they need and the parent flow doesn’t have to know the sub-flow internals.

  2. Love the sleuthing!

    How does it work for nulls? Does “Automatically store all fields” appropriately set null if no records are found?

    1. Yes. The Get Records variable is set to null regardless if it’s “Fetch All Rows” or “First Row”.

Comments are closed.