web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate Bad Gat...
Power Automate
Answered

Power Automate Bad Gateway error while trying to insert a row from lists to sql server

(0) ShareShare
ReportReport
Posted on by 26

I have been trying to create a very simple (lists to sql) power automate workflow that triggers when an item gets added/modified in Microsoft Lists and gets updated in my SQL DWH.

The Title column is the default single-line text field provided by Microsoft. The Comments column is a custom field with data type multiple-lines of text.

 

 

In SQL I created a straightforward table, which contains two columns 'Title' and 'Comments', both of type varchar.

The Flow I created looks like this: 

flow.jpg

 

 

During the first sharepoint action I connect to the sharepoint list, no advanced options. During the get rows(v2) action I connect to the created table in SQL, again no advanced options. In the condition step I included some basic logic that determines whether the item in the list is new or exists. In the final step, that inserts or updates the row based on its existence, I run into an error. While all the previous steps work perfectly fine, I run into a 502 BadGateway error saying that the Insert_Row action has failed. I have been stuck for the last couple of days and haven't been able to find the solution. My SQL DWH is located in Europe and the PowerApps environment is set to EMEA.

 

Can someone please help out?

 

Please find below the error report: 

 

rutgerverhaar_7-1618832869988.png

 

rutgerverhaar_8-1618832927942.png

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    LaelH Profile Picture
    195 on at

    Hi rutgerverhaar

     

    I can't help you with your problem, but I can  propose an alternative means of achieving the same thing which may be a whole lot more efficient. Rather use the Execute a SQL Query and then use a "merge" query.  

    Flow would look like this

    LaelH_0-1618839030127.png

    And sql query would be something like:

    Merge into MyTable using

    (...my data fetched from sharepoint...) spData

    on (spData.Title = MyTable.Title)

    WHEN MATCHED THEN
    UPDATE SET 

    MyTable.Title= spData.Title,
    MyTable.Comments = spData.Comments

    WHEN NOT MATCHED THEN
    INSERT ( MyTable.Title, MyTable.Comments)
    VALUES (spData.Title, spData.Comments)

     

    Hope that helps

     

  • kierian Profile Picture
    Microsoft Employee on at

    Hello 

    Can you please provide flow URL and run  URL

    Have a good day

     

  • rutgerverhaar Profile Picture
    26 on at

    Thank you for the alternative! As soon as I found the issue that's causing the error when trying to update or insert rows into SQL i'll look into your proposed workaround!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I had exactly this 502 and found it to be a data error in one of my fields (using a True/False into a Yes/No field). Once I realised that by properly looking at the Raw Output from the sql action, I fixed it and all ok now.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard