I am building a flow that pulls data from Dynamics using a trigger that pulls data when we get an Insert or an Update in dynamics. I then query my sql table using the ID from the trigger to determine if the row is in the table or not. If the row is in the table I send the row down an Update path and if it is not in the table it goes down an Insert path. Here is the flow.
The flow however fails on the insert. The condition seems to be the cause of the problem. I am using this code
"empty(body('Get_rows')?['value'])" to determine if my query returned any results. It seems to push it down the insert path but fails on a 400 error saying "The key didn't match any rows in the table \r\n". I tested the insert above the Get Rows and it works fine there. The insert is working correctly. It appears my condition statement is causing the problem. Any ideas I can use that will allow me get this to run both on the Insert and on the Update?