I'm trying to make a flow in which when an item is created or modified from List 1 it creates List 2 but if List 1 I would like for List 2 to update.
Right now when I modify list 1 it creates a duplicate in list 2 and I dont want that. I want for the one in list 2 to update only.
Can you please post a screenshot of the current flow?
You can use the Update Item in sharepoint action to update the item in list 2 whenever an item is updated in List 2.
You can add a get items action after the trigger and modify the filter query to get the items that match some unique value in List 2 from List1. Only if there is a match you will get just one value and you can update it in case of updating and the item already exists. Now if the item is new, you can check the length of the items retrieved in the get items and if it is 0 create a new item in list 2. (Makes sense?)
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
I agree with @yashag2255 - he mentioned that you need to be able to identify items in list 2 that relate to items in list 1. I suggest adding a column to list 2 where you'll store the ID of the item from list 1. That will make it easy to identify what item in list 2 should be updated when an item in list 1 is updated via the filter query/OData filter.
Please see my screen shots below.
I use two lists - List A and List B. I added a column to ListB called ListAID to store the ID of the corresponding entry in List A. The column that I added is a number with zero decimals.
My GetItems action for ListB uses a Filter Query so that only items that correspond to to the entry in ListA are returned (there should either be one or none). Note the single quotes around the ID in the filter query.
If no items are returned, I create a new item.
If there is an item returned, I update that item.
@ScottShearer Can you show how the flow will look if I have to only create items from List A to list B if the field Location equals "Florida".
I only want list B to get items from list A that have the location field set as "Florida"
To limit to entries where the location field is Florida, simply add the following to the filter query:
and Location eq 'Florida'
If you don't want to create items unless the Location is Florida, you'll want to put in a condition that cheks for that at the top of your Flow - if the lcoation ins't Florida then exit your Flow with a Control Terminate action. So, if no entries exist other than those in Florida, you don't need to check for that in your filter query - it can stay unchanged.
Hi @ScottShearer ,
I am pretty sure I have done everything correctly in my flow:
List A - 41G Schedule
List B - 41G Monthly
I have added the column (number w/ 0 decimals) to List B called 41GScheduleID to capture List A ID.
The error I get in the flow is this:
"message": "The expression \"41GScheduleID eq '282'\" is not valid.\r\nclientRequestId: ec554315-3b7a-4e6b-b82c-6e3884ea0580\r\nserviceRequestId: ec554315-3b7a-4e6b-b82c-6e3884ea0580"
...and its in the Get Items part.
Any ideas? Thanks.
Hi @ScottShearer ,
Thanks for the quick reply.
I tried that and now got the following error still in the 'Get items' part:
"message": "The expression \"41GScheduleID eq 291\" is not valid.\r\nclientRequestId: 7a4dfcbf-bcd0-439f-b172-bb874c10f43c\r\nserviceRequestId: 7a4dfcbf-bcd0-439f-b172-bb874c10f43c"
Changed a couple things and it worked!
I abandoned trying to filter by ID number and moved to 'Job Title' like this:
The condition checked for the Job Title as empty (0) and was written like this: equals(length(body('Get_items')?['value']), 0)
Please also note that the space in between Job and Title must be replced with _x0020_ .
Works perfectly. Thanks to all above for the help!
Ugh. Not fully resolved.
My workaround only partially works. If I sort by title, two bad things can occur:
1. If there is an update that includes a change in title I get a new entry on the destination calendar
2. If there is a duplicate title (ex: "vacation"), then I get an overwrite condition and I lose an entry
Clearly I need to figure out how to use the ID in the Filter Query due to the uniqueness of the ID number.
As mentioned above, I have tried to make the new column both a text and number column and respectively inserting the single quotes around the dynamic content ID symbol in the filter query entry.
I have also tried both equals(length(body('Get_items')?['value']), 0) and empty(body('Get_items')?['value']) 'is equal to' 'true' as the condition
Here is the error:
I apologize for the wasted pixels if this is unnecessary, but here is the info from the headers box:
Speakers, submit your sessions now! Call for speakers ends Feb. 10!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
We've given our badges an overhaul and also added some brand new ones!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!