I'm trying to create a flow that takes a submission from a Form and adds it to a Spreadsheet hosted on Sharepoint. Here is how I currently have it set up:
1.) When a response is submitted, and I select my form
2.) Get response details from the form
3.) Initialize Variable. The name is "isDuplicate" and it is set to "false"
4.) List rows present in a table - I selected the spreadsheet on SharePoint
5.) For Each - select an output from the previous steps: body/value
6.) Condition - if "Employee ID" from the spreadsheet is equal to "Employee ID" from the form AND "Facility", from the spreadsheet, is equal to "Employee Facility" from the form (thus, identifying the duplicate entry)
If True - Set variable "isDuplicate" to TRUE
If False - nothing
7.) New Condition - Not nested in "For Each" if 'isDuplicate' variable is set to "true"
If True - send an email to the user letting them know - then set 'isDuplicate' variable to false
If False - add form submission data to Spreadsheet
unfortunately, this is not working...and I cannot, for the life of me, figure out why... It must be that I dont have a solid understanding of how Power Automate is rendering the data?
I assumed if I kept the "For Each" loop separated, then Power Automate would cycle through all of the current entries in the Spreadsheet... if, after cycling through all entries (currently sitting at 83), it does not find a duplicate value, then "isDuplicate" remains "false" and, thus, gets added to the Spreadsheet
If it cycles through all 83 entries and a duplicate is found, even if that duplicate is found on line 53, then lines 54 through 83 all still get checked, per the "for each" loop, but since they're all "false" and "false" is "nothing", then 'isDulicate' should remain "true" until it's set back to "false" after sending the email.
However...Power Automate still just adds the submission to teh Spreadsheet, even though a duplicate entry already exists.
See attached screenshot for a visual... you can ignore the very first condition, all it is doing is checked a selection box, from the form, to determine which path to pursue. It's all of the actions nested under the "True" statement that I am struggling with.