cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
johngabbradley
Level: Powered On

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 Team
Community Support Team

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

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 248 members 4,313 guests
Please welcome our newest community members: