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

Community site session details

Session Id : WB14GV9MoeZvMP5C5abrvB
Power Automate - Using Connectors
Answered

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

Like (0) ShareShare
ReportReport
Posted on 19 Apr 2021 11:58:01 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

 

 

 

 

  • Community Power Platform Member Profile Picture
    on 24 May 2022 at 10:54:17
    Re: Power Automate Bad Gateway error while trying to insert a row from lists to sql server

    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.

  • rutgerverhaar Profile Picture
    26 on 19 Apr 2021 at 15:40:10
    Re: Power Automate Bad Gateway error while trying to insert a row from lists to sql server

    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!

  • kierian Profile Picture
    on 19 Apr 2021 at 14:04:46
    Re: Power Automate Bad Gateway error while trying to insert a row from lists to sql server

    Hello 

    Can you please provide flow URL and run  URL

    Have a good day

     

  • Verified answer
    LaelH Profile Picture
    195 on 19 Apr 2021 at 13:37:25
    Re: Power Automate Bad Gateway error while trying to insert a row from lists to sql server

    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

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Featured topics

Loading complete