cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

SQL Insert Fails after Condition

Hi,

 

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.
Flow Insert.PNG

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?Flow Error 1.PNGFlow Error 2.PNG

 Flow Error 3.PNG

1 REPLY 1
Highlighted
Community Support
Community Support

Re: SQL Insert Fails after Condition

Hi @johngabbradley,

 

Could you please share a full screenshot of the configuration of the "Insert Asset Stage" action in the flow?

Could you please share the full error message of the  "Insert Asset Stage" action when the action run failed?

 

Please share more details so we would try to provide a proper workaround for you.

 

Best regards,

Alice

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (6,352)