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.
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).
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.
Next we have a "Condition" that checks the Outputs value of the above "Get items" action to check the length of EmployeeID in SharePoint.
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.
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:
"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.