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 Apps / Get Record ID of recor...
Power Apps
Answered

Get Record ID of record I just saved

(0) ShareShare
ReportReport
Posted on by 1,146

Thanks for taking the time to read my question.

 

Is there a way to get the Dataverse record ID of the record I just saved using SubmitForm()?

 

A quick search says I can do this if I use Patch()... Do I need to change?

 

Thanks

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,573 Most Valuable Professional on at

    If you are using a form you should be able to do something like this on the submit button.

    SubmitForm(Form1);UpdateContext({lastID: Form1.LastSubmit.ID})
  • Adrian_Celis Profile Picture
    1,652 Moderator on at

    Hi @iwonder 

     

    You can use this syntax: 

    YourFormName.LastSubmit.ColumnName

    So if you have an ID column in your table and the form name is Form1, then you should have:

    Form1.LastSubmit.ID

     

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @iwonder 

    In your OnSuccess action of the form, you can get the ID there.  If you were setting this to a variable, then:

    UpdateContext({submitID: Self.LastSubmit.ID})

     

    @Pstork1 you will not want to put anything after the SubitForm as there is no guarantee that the SubmitForm has completed, or if it was successful.  So putting the UpdateContext after the submitform function can lead to inaccurate results.  Having it in the OnSuccess guarantees that it will be accurate.

     

    I hope this is helpful for you. 

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard