cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Sharepoint when created or modified with match function and condition

Hello, 

 

I've been trying to get this Flow to work correctly for a couple of days and now I'm reaching out to the community for help. 

 

My Flow currently has a user interacting only with the "child" list and it updates the "parent" if the unique identifier is present (Parent Site ID or Child Site ID). If the unique identifier is found on the parent list, then update that previously existing ID with the new info. If the unique identifier is not found on the Parent list then create a item on the Parent list.

 

What is happening now is Flow is seemingly duplicating all the number of rows that is on the parent list when an item is added to the child. (i.e., parent has 5 items, and child has one, then when adding one row to the child list the parent would then have 10 rows all with duplicative values).   I've searched and followed https://powerusers.microsoft.com/t5/Building-Flows/SharePoint-List-Item-Created-Or-Modified-with-con... but when I'm inputting the condition formula ( @equals(length(body('Get_items')?['value']), 0) ) I get an error, and I'm not sure if the title eg' is even working.

 

Any help would be greatly appreciated.

 

Sharepoint Flow.png.jpg

4 REPLIES 4
Highlighted
Helper I
Helper I

Re: Sharepoint when created or modified with match function and condition

To update: 

 

I tried in the filter Query section of the Get items card Title eg' Child Site ID' 
Child site ID = TriggerBody()?['Title'] 

 

it says the flow was a success, but it looks like it stops at the Apply to each section of the condition card. 

 

Thoughts? 

 

 

 

Highlighted
Super User II
Super User II

Re: Sharepoint when created or modified with match function and condition

You have no items being returned by Get Items which means your Query is wrong.

 

Your logic should be as follows.

 

ListA - the user enters into this list

ListB - has additional column i.e. ListAID which is populated by ID from ListA.

 

Flow runs on List A.

 

Get Items from ListB where ID eq 'ID' 

The 'ID' in the brackets is the dynamic content of the ListA ID column.

 

Your condition will be pointless as you will only get the 1 item back and therefore the no branch will never get hit.

 

Instead add a compose that checks if you get values back i.e. @{length(body('Get_items')?['value'])}

 

Then do a condition on the outputs i.e. outputs greater than 0. Yes = Update and No = Create

Highlighted
Helper I
Helper I

Re: Sharepoint when created or modified with match function and condition

Hi @Gristy ,

 

Thanks for the input. I implemented your fix, but we still have an issue that I was hoping we could work through. 

 

With that said, List A is not the sole source for populating List B (I think there's about 7 lists that update the Parent list - or List B). When I implemented your fix, It appropriately captured when creating new (Outputs > 0 = false = create item), but when an item on list A was edited it would still create another line item / row in List B (instead of updating the record that was already there, it would create a new line item with the modified fields) - which is not ideal. 

 

So that comes with a couple of questions / clarification that might help. 

1. Child Site ID and Parent Site ID fields contain a unique 5-digit identifier for that particular asset, and are not reused 

              - The helper ID column that is populated from ListA might not work due to each feeder list having it's own ID that another list doesn't have (7 lists feeding 1) / or if there is an instance of updating a record that is already in ListB and a ListAID hasn't been created - it wouldn't be able to find that ID to edit the correct row. 

 

2. Child Site ID and Parent Site ID are actually the 'Title' fields in their respective lists, but have the names changed (even if that doesn't actually change the name of the column). 

 

Looking forward to any thoughts, 

 

Highlighted
Super User II
Super User II

Re: Sharepoint when created or modified with match function and condition

The concept works the same, i guess you cannot use ID by its self if you have 7 lists feeding in, you will need to store the listname and the ID or some unique combination depending on the list like LISTA103, LISTA104, LISTE102, LISTE103. you can play around with REST querys in the browser to make sure the correct results are returned.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Users online (6,614)