Hi.
Could you explain why you are using the Collection operation to do the same thing that is accomplished in the For each? Both are setting Two_weeks_dates to the current item in the collection.
Also, is the Collection operation contained within the For each loop?
Thanks @ethurber thought I needed Collection Operation to store the information from the list? So I could just do a For Each and store in a Collection variable then use that to do the comparison in the Run IF action?
Hi.
No. The for-each loops through the collection and stores each entry in the variable specified (not a collection variable). From what i can tell from your screenshot, you have the for-each configured properly. From that point, you can process that variable any way you want. Just be sure that all of the processing is in the for-each loop. When the processing is complete for that item, it will return to the top of the for-each and pull the next item from the collection and store it in the variable. It will repeat until all items in the collection are processed.
I hope this wasn't more information than you needed.
Ed
Thanks @ethurber that's really helpful.
So I want to store the user name and start date then have actions fire if the start date = the start date + three months. I have a query list action which is returning all the users names and start dates. What's the best way to store these variables so that I can do the comparison and trigger the actions?
This is how the For Each is configured:
and here's the flow as it stands:
Thanks for all your help!
Hi.
This is what came up with based on my understanding of your requirements. It's a site workflow that is scheduled to run daily. I'm assuming that you wanted to send an email to the employee (i can't read the label on you send email action)
The query list action
For each action
Run if action
Collection operation
Hope this helps.
@ethurber how would I configure the Calculate cut-off-date action? I'd need it to be the Start Date plus 30 days and then store it in the datCutOffDate variable in your example?
The cutoff date is the current date - 90 days. This is used to filter the query because you are not interested in any dates older than 90 days.
Thank you so much for your help @ethurber . I'm a still a little confused by the cutoff date. For example I need the alerts to fire if the employee is one month on from their start date. So if their start date was the 16th I'd need it to fire send an alert on the 16th of December. So would I not get their start date then add a month in the Calculate Date and then would I need to filter the results later?
Thanks again!
Hi @Sutekh.
The cutoff date is the current date - 90 days. It is only used to filter the query. Rather than read in the entire list, you are only interested in those employees who were hired within the past 90 days. You will get everyone that was hired within the past 90 days, but the ones you don't want get filtered out here.
the 3 calculate date actions take the start date of the current collection entry in the for-each loop, and add 30, 60, and 90 days respectively.
Note that each action stores the resulting date in a different variable.
The run-if compares each of those variables with the current date.
if 1 of those dates is the current date then the email is sent. If none of the dates are the current date, then it is skipped, the flow returns to the top of the for-each, and the process repeats with the next start date in the collection.
Hope this helps
Hi @ethurber I think I'm getting closer! I ran the flow and the Run Ifs aren't firing any alerts so I put an alert in to myself to see what the variables were returning. I got hundred of emails as it's returning the start dates of the staff and adding the additional time
One month: 14/10/2020 00:00
Three months: 29/07/2018 00:00
Six months: 29/10/2018 00:00
datStartDate datStartDate
Today: 01/01/1900 00:00
CollectionStartdate: 14/10/2020 00:00:00;22/10/2020 00:00:00;04/10/2020 00:00:00;06/10/202000:00:00;04/06/2020
So the datStartDate Date variable isn't returning a result and I'm trying to use that in the Run IF
Here's how I've configured the For Each action:
Really appreciate your help! Where am I going wrong?