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 / ID(Autonumber) in case...
Power Apps
Answered

ID(Autonumber) in case of EditForm and NewForm?

(0) ShareShare
ReportReport
Posted on by 42

I am dealing with table1.LastSubmit.ID, NewForm and submit data on two table to sql server.

so in case EditForm, it should take id(autonumber)(from table1) and saved it table2. in case  FormNew(table1) I am using table1.LastSubmit.ID which works fine. 

 

how do I do condition to apply if editform then take existing id from form(table1)  and incase of new records take table1.LastSubmit.ID

 

I am using SubmitForm; Patch(table2,deafults(table2,{id:table1.LastSubmit.ID}) works fine. but want to apply condition like above.

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    37,229 Super User 2026 Season 1 on at

    Hi @sanrajbhar

     

    The best way to test the whether a user is editing or adding a new record is to check the mode property of the form.

     

    Your edit form will have an Item property, and this will be set to something like BrowseGallery1.Selected. You can call the ID property of this to retrieve the ID of the record that a user is editing. You code would look something like this:

     

    SubmitForm; 
    If(EditForm1.Mode = FormMode.Edit, 
     Patch(table2,Defaults(table2,{id:BrowseGallery1.Selected}), 
     Patch(table2,Defaults(table2,{id:table1.LastSubmit.ID})
    )
    
    

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 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard