Workflow Hero

Using For Each/Collection Ops actions to fire if a date criteria is hit?



I have a list of users with different dates that they began employment. I've written flow which stores the date they began employment, then has some Calculate actions which adds days/months so that a set of actions will fire if todays date is the start date plus the added time. Fine it works.


So now I need to set it up as a scheduled flow so that it'll loop through the list every day and trigger actions if a 1 month, 3 month, or 6 month  date range is hit. I know I need to use a For Each action and a Collection Operation but I'm struggling to work out how to configure it. Any guidance gratefully accepted. Here's how I've configured the 1 month Collection Operation but I'm really working in dark.

0 Kudos
1 Reply
Cloud Wanderer

Re: Using For Each/Collection Ops actions to fire if a date criteria is hit?


If I'm understanding your requirement, I would suggest the following.

  1. Store the employment start dates in a collection.  Filter to only collect those dates that are within 6 months of the current date
  2. Loop through the collection with a "for each".
  3. Within the "for each' loop, use a parallel operation activity with 3 branches
  4. 1st branch calculates the 1 month date and stores it in a variable.
    1. if that value equals the current date, then set a yes/no variable to "Yes"
  5. The remaining branches perform the same action for the 3 and 6 month dates.
    1. be sure to store each date in a unique variable
    2. Use the same yes/no variable in each branch.
  6. After the parallel operation, but still within the for each loop, use the yes/no variable to determine if any actions should be done.
  7. Reset the yes/no to "no"
  8. Return to top of the "for each" to process the next employee.

Hope this helps

0 Kudos