cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AWaxPortrait
Level: Powered On

How do I get the current item or current record while in an edit form?

This feels like such a basic question, but I'm moving between screens in a powerapps form, how do I get the current record? I need it to Patch the item.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: How do I get the current item or current record while in an edit form?

@AWaxPortrait
It is a common question but I can tell you there is no concern using LastSubmit. The LastSubmit property refers to the last record successfully submitted by the current user. It does look at the datasource to find the latest record created by all users.

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: How do I get the current item or current record while in an edit form?

@AWaxPortrait
If you have clicked on a gallery to open the Edit Form screen you can use: Gallery1.Selected in the 2nd argument of PATCH.

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
AWaxPortrait
Level: Powered On

Re: How do I get the current item or current record while in an edit form?

Well, I have a button that's outside of the form that I want to click and have it edit one of the fields in SharePoint, but for that I need to use Patch and for that I need the current record.

AWaxPortrait
Level: Powered On

Re: How do I get the current item or current record while in an edit form?

SubmitForm([@FormEdit]); Navigate(ScreenEdit_2, ScreenTransition.Fade); Set(itemID, ThisItem.ID);

 

This is what I'm trying to use in my button to get to the second page, but the ThisItem function only works in the form itself.

Super User
Super User

Re: How do I get the current item or current record while in an edit form?

Thank you for supplying your code. To SET the itemID you can use the LastSubmit property of your form.

SubmitForm(FormEdit);
Set(itemID, FormEdit.LastSubmit.ID);
Navigate(ScreenEdit_2, ScreenTransition.Fade);

Then on your 2nd screen you can PATCH like this

Patch(your_datasource_name,LookUp(your_datasource_name,ID=itemID),{your_field1: your_textinput1.Text})

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
AWaxPortrait
Level: Powered On

Re: How do I get the current item or current record while in an edit form?

You know the only concern I have with LastSubmit is, if multiple people are working on the list in SharePoint, isn't it possible that someone could have submitted another form, and that number will then get used instead of the number for the current item?

Highlighted
Super User
Super User

Re: How do I get the current item or current record while in an edit form?

@AWaxPortrait
It is a common question but I can tell you there is no concern using LastSubmit. The LastSubmit property refers to the last record successfully submitted by the current user. It does look at the datasource to find the latest record created by all users.

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,588)