function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sam Becker 12Sam Becker 12 

Create Visual Flow Loop through 1 object's field values?


I'm trying to create a visual flow that checks the value of about 50 custom fields that are all TRUE\FALSE on a custom object. For each TRUE value, it creates a detail record.

Do I have to create a decision for each Boolean field? or is there a way to use a LOOP to go through 1 objects field values?

Any help would be appreciated. I'd rather now have a giant tree just to check whether a box is TRUE or FALSE.

Thank you!
Best Answer chosen by Sam Becker 12
Agustina GarciaAgustina Garcia
Yes, you can do it.

First of all you could go for some Apex code with @InvocableMehods (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm) but if you prefer #clicksnotcode, then there is a way to do it also.

This is my flow. CO1 is a object with Field1__c and Field2__c both checkboxes. 

User-added image

1st - Make a SOQL and asign Field1__c and Field2__c values to 2 new variables.
2nd - Assing these values to an Assignment Collection.

User-added image
Where CollectionFields is a collection variable

User-added image

3rd - Then do the loop

User-added image

4th - Finally check values of each value 
5th - If value is true, create a new CO2 custom record.

Hope this helps

All Answers

Agustina GarciaAgustina Garcia
Yes, you can do it.

First of all you could go for some Apex code with @InvocableMehods (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm) but if you prefer #clicksnotcode, then there is a way to do it also.

This is my flow. CO1 is a object with Field1__c and Field2__c both checkboxes. 

User-added image

1st - Make a SOQL and asign Field1__c and Field2__c values to 2 new variables.
2nd - Assing these values to an Assignment Collection.

User-added image
Where CollectionFields is a collection variable

User-added image

3rd - Then do the loop

User-added image

4th - Finally check values of each value 
5th - If value is true, create a new CO2 custom record.

Hope this helps
This was selected as the best answer
Sam Becker 12Sam Becker 12
Thank you very much! This is exactly what I needed.