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 / Auto Increment ID on I...
Power Automate
Answered

Auto Increment ID on Insert Row MySQL

(0) ShareShare
ReportReport
Posted on by 6

Hello,
I am currently working on a flow that inserts data into a table from an HTTP request
When using the "Insert Row" (MySQL) it requires me to provide an ID, even though in my table the ID is set to auto increment so I should not have to provide one.

Screenshot 2022-09-22 at 11.21.29.png

I know the problem probably lies with PowerAutomate not knowing/guaranteeing that it is set as auto increment, but is there a way to do so? I find it odd if the only solution is to do a: "Gew Rows, OrderBy ID Desc, Max 1" and then an id + 1. 

I cannot find anything about this issue anywhere (other than the Get Rows solution) so I'm trying my luck here 🙂 

Categories:
  • MagnusPedersen Profile Picture
    6 on at

    A very kind guy in a Discord community suggested just providing "null" as an expression, which surprisingly worked in terms of getting the value into the DB and the auto increment working just fine. 

    However, PowerAutomate throws a "Bad Request" status 400 error when doing this, even though the data is inserted into the table. 

    Screenshot 2022-09-22 at 12.29.03.png

    What is even more weird about this is that I am doing the inserting in an apply to each loop, and both values in my test case are put into the table, which means that PowerAutomate does not even stop after the first insertion, but does the entire loop before complaining.

    Does anyone know why this is happening, and/or how to deal with it?

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @MagnusPedersen ,

     

    It is the limitation of MySQL connector. Please see below doc:

    MySQL - Connectors | Microsoft Learn

    Insert row operation requires to provide explicit value for Primary Key column, even though default/autoincrement value is defined.

     

    Best regards,

     

  • MartinaRizk Profile Picture
    30 on at

    Hello @MagnusPedersen ,
    I have the same error, if could you figure it out, can you please share with me?!

  • MagnusPedersen Profile Picture
    6 on at

    Unfortunately it seems there is no "good" solution to this problem as of right now. I just ended up having to get the last ID from my table and then +1 for each insertion. 

  • MartinaRizk Profile Picture
    30 on at

    Thanks so much for your reply @MagnusPedersen 🙂

  • luiber222 Profile Picture
    3 on at

    Buenos dias, si es tan amable de mostrar como lo hizo, ya que tengo el mismo problema y no he podido avanzar por eso no mas-.  gracias

  • CREYMOND Profile Picture
    2 on at

    Hi,

    Could you tell how you manage to get the lastinsertid with power apps?

    Could you send a screen shot of your flow?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 298 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard