Hi,
I'm trying to set a current item in an Edit form on a screen in a power apps for teams app.
The form is called Form1. I didn't want to store the to-edit entry a global variable, so when I navigate to this screen it's either for a new entry or from a given Param. This is what happens in OnVisible:
This is great, thanks.
So what I was missing;
The form is reset in the other screen which navigates to this edit screen.
Then this same screen sets the form to be new, edit or view.
In the screen showing that one record, if it's an edit form, it looks up which one to edit in its "Item" property by using a formula that chooses the Selected item from the gallery.
yes you can use the same form for either New entries or for existing ones.
this video should help you solve it:
Power Apps Form Control Tutorial - New Edit Form (youtube.com)
you just have to set Newform(Form1) or Editform(Form1) on the right places to achieve what you are looking for.
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings
Thanks for the suggestion.
I don't really see the point in not being able to programatically set this "Item" value from another function.
Using your suggestion, I might be able to use this form to edit a record (and which record being the result of a function in the "Item" property. (When is this function evaluated exactly? And is this once?))
But, I still want to be able to use this same form to be able to create a new record.
I don't like duplicating work. It's all the same, the same screen, same layout, same buttons for saving, canceling etc.
In the end I just want a screen with a form that's either for a new record, or for editing an existing one.
Maybe there's another way? I just don't like duplication, and in my opinion it should be all the same stuff.
hey @Jvds
i did not fully underatand what you are trying to do here.But in my point of view its not working that way.
The error arises because Form1.Item(Param("SelectedItem")) is not a valid operation. The Item property of a form should be set to the record you want to edit, but this assignment can't be done as a method call like you're attempting. Instead, you should set the Item property of the form in the properties panel to an expression that evaluates to the record you want to edit.
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473