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 / Create new record on M...
Power Automate
Answered

Create new record on MySQL table

(0) ShareShare
ReportReport
Posted on by 21

Hello. Sorry if I'm cross-posting here, but I've been searching and searching all over the forum, and the internet, and I can't find a good solution for doing this. Besides that, I'm very new to Power Automete (Flow), so please forgive me if someone has already posted a solution for this and I couldn't found it.

 

So, basically I'm trying to create a fllow that creates a new record on a MySQL table (connector is working and tested), each time a message is flagged in Outlook. So, I've created a new Flow (Outlook - When a new mail is flagged V3) and then added the action of creating a new row (MySQL Insert Row).

 

As I've read on other forum posts on this forum, for database engines other than MSSQL, I need to create a mandatory Id field, which I was expecting to be automatically filled, as the Id field on the MySQL table is set to INT, Primary Key, Auto Increment ( I can't change this, because the table is part of a self-hosted desktop application.

 

mysql_id.PNG

 

 So, once the Id can't be automatically generated by the flow, how can I get the last Id record from the table and, then, increment by one, using an expression?

 

I've tried using LAST function, based on some suggestions here at the forum, but as I'm a noob with Power Automate, I wasn't able to get it working. Also, I was trying Get Row, but I really can't find a way.

 

Is there anyone who has already have some MySQL new record example working, or Postgres (I think the problem is the same) who can help me here?

 

Thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @josecardoso 

     

    I didn't have MySQL earlier and installed one now. This is what I did to increment the index. Please follow the steps:

    My index id column is called idJobTypes which is an auto increment one.

     

    image.png

     

    Above I did used the Get Rows records top one only order by idJobTypes (Primarykey) desc. This will give you the latest number in the db.

     

    Next iterate the result and store in a variable. Finally increment the identifier value and insert the row values using the latest incremented id. See below.

     

    image.png

     

    The expression I am using above is 

     

    add(variables('Id'),1)
     
    Below is my test result
     
    image.png
     
    If you have any questions please let me know.
     
    Thanks
    Thanks
  • josecardoso Profile Picture
    21 on at

    Many thanks @abm. Perfect, this worked like a charm!

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
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard