Access Complex Merge Fields from Loops – Flows

We have been using Salesforce Flows for a while now and it certainly has saved us a lot from writing and maintaining simple apex logics.

The Loop element becomes crucial when we consider a complex flow structure, and I have personally been challenged by further customization using a lot of Apex Defined variables.

Consider the below apex class I use as a Apex-Defined variable in my flow.

public with sharing class ApexObject {
    public String someString;

    public List<String> stringCollection;

After assigning some values to the stringCollection from the flow, there was a need to write down a for loop inside the class (or another), extract the required values and carry those back to the flow.

But starting this release, Salesforce has made it possible to directly run the Loop on the ApexObject.stringCollection in the flow itself. This way we save ourselves from writing that extra for logic and cut down the extra jump between the apex class and the flow.

This is how it looks in the flow.

Super crazy, isn’t it? 🙂

Leave a Reply