cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to get the newly added record from SQL database when PK is non-numeric?

I'm building a PowerApps canvas app with SQL Server Azure database as the data source. I have a USERS table with two columns, EMail being the PK.

 

USERS(EMail, RoleId)

 

The RoleId references another table but it's not important for the purpose of this question. When a new user is added to the table, I'd like Power Automate to send an EMail to the person using Outlook connector. Usually, once the 'record added' is triggered, the way I get the 'latest' record is by sorting the ID desc, and getting the top 1 record. Below is an example of how I do it, in another table.

 

Capture.PNG

 

Above works because every time I add a record the RFQ_ID is increased, so the largest RFQ_ID is always the latest record. But obviously this won't work with an email. Is there a way to get the newest record that isn't based on sorting data?

 

Note:

ITEM CREATED Tickets is a 'When an item is created (V2)' SQL trigger.

GET NEW RECORD Tickets is a 'Get rows (V2)' SQL trigger.

4 REPLIES 4
abm
Super User
Super User

Hi @Anonymous 

 

Could you please explain more why it doesn't work with mail? What's the process? 

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
Anonymous
Not applicable

@abm because sorting email won't necessarily give you the most recently added record.

Hi @Anonymous 

 

Add a new column called 'SendEmail' boolean field, default as false. Filter the record by false and send the email. Once email is sent then update the flag to true. Is that works for you?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
Anonymous
Not applicable

Well, that technically can work, but that's a rather a large detour for something that should be simple. Also, the user table is but one example of many tables I need to do something after adding a record so doing this for each table is very redundant and error prone. I was wondering if there's a feature in SQL connector or some other way that would easily identify us the newly added record.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,166)