Hi all,
I have 2 SP lists, '21-22 PreEnrollment' and '21-22 ClassRoster.' Once a day, I'd like to have a Flow check the PreEnrollment list for any items with today's date in the 'Start Date' field. If the Start Date is today, I want the Flow to then check the ClassRoster list for an existing item (both lists have the same unique ChildID for each item). If the item exists, update the Start Date, otherwise create a new item.
I've got it partially working, in that items with today's Start Date will add to the ClassRoster, but instead of updating existing items the Flow just creates a new item. I've been browsing the forum for a few hours now and every solution seems to refuse to work and I'm not sure why.
Flow Overview
ODATA Filters for both 'Get Items'
Expression for Condition
Hi @susannarae
Your opening PreEnrolls Items looks fine but probably no need for a filter on childid in the get roster as you can filter on the array. You also want to avoid nested apply to each actions.
Using the method you have attempted, you could create an apply to each on the values from your first get items and then perform a filter array on each item with the 2nd list values in the from of the filter. If the filter array length is 0, create the item, otherwise update the item. This would only need 1 apply to each.
Alternatively, how familiar are you with the concept of intersect and except? You could tackle this by creating an array of intersect where the child id exists in both and an except, appear in one but not the other. Once you have these two arrays, you can run an apply to each on both arrays and either perform your create or update as necessary. I did an article on intersect and except here.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here
Your solution seems to be almost perfect, but for some reason Flow keeps adding a second 'Apply to Each' to my 'If no' condition, which then updates and changes the names/info on every kid to match the existing list item. How do I get rid of that unwanted nested 'Apply to Each'?
Hi @susannarae
It will be creating the apply to each based on the dynamic values you are selecting for your update item action, which are presumably part of an array. If you share a screenshot of your flow and in particular your unwanted apply to each I will try and work out how/why.
For your update item ID, you would want to take the ID from your filter array values.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here
Here is a screenshot of the unwanted Apply to Each as well as the Filter Array. I appreciate your help on this, it's been giving me issues for days now.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
73 | |
27 | |
22 | |
15 | |
15 |
User | Count |
---|---|
143 | |
43 | |
42 | |
34 | |
31 |