You need to sign in to do that
Don't have an account?
huskerwendy
Flow design help - using Loop logic to loop and create records until loop counter is reached
I need help determining the logic to use in my flow. Basically, I want to call a flow from process builder that will create new records based on the value passed in from the process builder. We have a custom obejct (transaction) and a new records is created, if the frequency of the parent object of the transaction is "Annual", I need the flow to create 11 additional records with the date for each record equal to the first day of the next 11 months. If the frequency is "Quarterly", I need the flow to create 2 additional records with date equal to the first day of the next two months. If the Frequency is "Semiannual", I need the flow to create 5 additional records with the date of each one equal to the first day of the next 5 months.
Is this somethig flow can do? My plan was to create a counter based on the frequency and then loop until the frequency counter is reached. However, I can't seem to figure out how to loop through anything other then a Salesforce object. However in this case the objects don't exist yet.
Is this somethig flow can do? My plan was to create a counter based on the frequency and then loop until the frequency counter is reached. However, I can't seem to figure out how to loop through anything other then a Salesforce object. However in this case the objects don't exist yet.
LoopCounter increment
Check Loop Counter
All Answers
https://help.salesforce.com/articleView?id=vpm_records_create.htm&type=5
Thanks for you response. I understand how to create new records. What I don't understand is how to loop through a record set that is not an sObject. I've attached an image of my flow. However, it's not actually working. I don't think my loop is correct.
here's my loop definition
Here's my record count assignment
LoopCounter increment
Check Loop Counter
Now looping through a collection of records, incrementing the counters is no longer needed.
Instead the record count can be easily fetched in a sobject collection variable and assigned to a number variable. Play around with the count variable directly. So finding out the number of open/closed/in progress opportunities gets more easy. I can think of many more use cases that will be benefitted because of this feature.
So to answer this question, all you simply need to do is like:
1. Perform a fast lookup with your required filters
2. Assign the record count to a sObject collections variable. (in screenshot: nofCases)
3. Use a Assignment step, to assign the variable to a number variable. (Point to note: the assignment variable should be of type number only to make use of equals count operator. In the screenshot, this is called testCount)
4. Voila! Now play the hell around with the assigned variable :)
If this helped anyone here, dont forget to hit the thumbs up.
Cheers!!
Roy