web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set(VarRecord, This It...
Power Apps
Answered

Set(VarRecord, This Item) to Replace BrowseGallery1

(0) ShareShare
ReportReport
Posted on by 3,271

Hi community.

 

I was checking a video from Shane Young

 

And he mentioned that is better to start replacing the onselect = Navigate......... 

by:

Set(varRecord, ThisItem);Navigate......

then in the target form items = VarRecord

 

Basically replacing Gallery1.selected.

 

He said that this method is better and secure.

 

Now my question is?

I did that and my target form is a form. After press to EDIT the form and save the changes the updates didn't come up. I have to go back select the item again and after that I can see the changes.

 

How can I fix this? I have tried Refresh etc but nothing works.

 

Thanks in advance,

 

Regards,

 

 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    @sajarac 

    In the OnSuccess property of your form add this code

     

    Set(VarRecord, yourFormName.LastSubmit)

     

    Change 'yourFormName' to the name of your form.

     

     

     

  • Sajarac Profile Picture
    3,271 on at

    Hi there, any other possible solution? my form is acting weird after I have implemented this option ?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @sajarac
    In the Item property of the edit form: Lookup(datasource, ID=VarRecord.ID) and make sure the datasource in the Form is the same one as referenced in the Item property.

  • Community Power Platform Member Profile Picture
    on at

    @sajarac 

    Define '...acting weird ...'. I use this throughout my apps without any issues

  • Sajarac Profile Picture
    3,271 on at

    Thank you.

    @Drrickryp @Anonymous 

    I did the Lookup addendum, it seems like is working a little bit better just one thing is not working fine. In the form I have 3 Dropdowns they work in a cascade way. I noticed that those 3 are keeping the last information saved. But if I put the form in edit mode and cancel or save the it show the right value.

     

    Any idea?

     

    Thank you 

  • Community Power Platform Member Profile Picture
    on at

    @sajarac 

    Sounds like the issue will be to do with the Default properties of those dropdowns.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @sajarac 

     In the OnSuccess property of the form, put ResetForm(Form1).  When the form is submitted successfuly, all of the controls on it will be reset to their default properties.  As a alternative, you can reset each control individually using Reset(Dropdown1); Reset(Combobox1); Reset(Combobox2).

  • Sajarac Profile Picture
    3,271 on at

    I did a Refresh in between changes and it shows the right information.

  • v-xida-msft Profile Picture
    on at

    Hi @sajarac ,

    Have you solved your problem?

     

    Based on the issue that you mentioned, I think this issue is related to the varRecord variable. If you update the selected record using your Edit form, you should also update the varRecord variable to the updated record simultaneously, otherwise, this varRecord variable would still store previous record.

     

    So please consider set the OnSuccess property of the Edit form to following:

    Set(varRecord, EditForm1.LastSubmit) // update the varRecord variable to the updated record

    Set the Item property of the EditForm1 to following:

    varRecord

     

    Actually, it is not necessary to store the whole selected record into a variable, instead, you could consider save the PrimaryKey column value of the selected record into a variable. Please also consider try the following workaround:

    Set the OnSelect property of the Gallery to following:

    Set(varPrimaryKey, ThisItem.PrimaryKeyColumn)

    Set the Item property of the Edit form to following:

    LookUp('Your Data Source', PrimaryKeyColumn = varPrimaryKey)

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Kathomsen Profile Picture
    35 on at

    I am using the Set(varRecord) for navigation also. It was working yesterday, but now my Patch statement to update my form (see OnSuccess below) is no longer working. Not sure what happened, nor how to resolve it. 

     

    Kathomsen_0-1594313678287.png

    Kathomsen_1-1594313775780.png

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard