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.
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.
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.
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.
The expression I am using above is