cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

Update item issue in Apply to Each causing flow to fail

Hi there and Happy Friday!

 

In my below flow, an unformatted excel file is added to the documents folder in a SharePoint Online site.
A table is then created.
There is then a 60 second delay to allow time for the table formatting to complete.

 

sudosaurus_0-1648224756160.png
For the List rows present in a table action I have the Pagination threshold set to 1800 as the excel file is importing approximately 1650 rows of data so it made sense to increase this a little to allow any sudden influx of new data (employees).

sudosaurus_3-1648225139398.png

Next in this "For each" action, we are getting the value of the "List rows present in a table action" and are using a Filter Query in the "Get items" action to check whether the value of the EmployeeID column in SharePoint is equal to the 'PersonalReference' value in the Excel file.

sudosaurus_4-1648225354003.png

Next we have a "Condition" that checks the Outputs value of the above "Get items" action to check the length of EmployeeID in SharePoint.

length(outputs('Get_items')?['body/value'])

If equal to true then a new item will be created in the sharepoint list and if false, it will branch off into the below "For Each 2" action where we have an "Update item" action. 

What happens here is that if it sees an item that aleady exists, it will either skip it if theres nothing to update, however if any of the other columns such as email, line manager or directorate are different then it will update those on the SharePoint list based on the EmployeeID number which is our main identifier here.

sudosaurus_2-1648224952416.png

The issue I am having is that I have discovered that there are some members of staff that have two separate job roles and therefore their EmployeeID is listed twice in the SharePoint list and therefore during the Update Item action, the workflow appears to be falling over as it doesnt know which row in the SharePoint list to update as there is obviously two rows with the same EmployeeID.

As we dont have any other identifier to differentiate between I'm not sure if theres a way to get around this unless someone here can think of anything?

 

The update action is failing with this error message:

{
  "status": 400,
  "message": "Save Conflict.\n\nYour changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.\r\nclientRequestId: f43c8eea-c3bc-47ce-8441-a70ad3b73a60\r\nserviceRequestId: f43c8eea-c3bc-47ce-8441-a70ad3b73a60"
}

and by my logic this appears to be due to it trying to update two rows where the EmployeeID is the same - there is no one else currently working on this apart from me so I cant see any other reason as to why this would not be working.

0 REPLIES 0

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,762)