cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

namecard Variable gets reset after SubmitForm()

This app has 3 screens. ListScreen1, EditScreen, covgScreen1

ListScreen1 displays all records in a SharePoint list named InsuredNameAddress.

The “+” icon adds a new record to the list by calling NewForm(Form1);Navigate(EditScreen, ScreenTransition.None, {NewItemVar:1})

The “>” icon edits an existing record by calling EditForm(Form1);Navigate(EditScreen, ScreenTransition.None, {NewItemVar:0})

listscreenlistscreen

EditScreen edit a record or add a new record to list. Once I click Next button, this record is submitted and saved to list by calling SubmitForm( Form1 ); Navigate( CovgScreen1, ScreenTransition.Fade, {NameVar: DataCardValue1, IDVar: DataCardValue21} )

 image.png

 

To make sure variables passed to next page correctly, I used two local variable NameVar and IDVar and displayed them on the top of next screen - CovgScreen1. I used this label to debug:

"Insured Name: " & NameVar & If(IsBlank(LookUp(coverage,SID=Value(IDVar.Text))), "HAHA",IDVar.Text) & " "& DataCardValue1 & " "& DataCardValue21

It works perfectly if I start with “>” icon to edit an existing record on EditScreen. CovgScreen1 shows correct Name and ID:

image.png

But if I start with “+” to add a new record record on EditScreen. CovgScreen1 shows blank Name and ID:

The variables are somehow get reset and Name and ID variables become blank on the next screen CovgScreen1. It does submit the form1 as I do see this new record in Sharepoint list.

image.pngimage.png

 

Could you please help to solve this mystery?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
New Member

Re: namecard Variable gets reset after SubmitForm()

Thanks a lot for your suggestion. This issue has borthed me so many days.

I can't believe it is solved by just using set() to pass the global varible. It works perfectly.

 

Have a great weekend!

 

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: namecard Variable gets reset after SubmitForm()

Hi @PingHouston,

 

If you would like to keep the last Submit ID of the form, please just take use of the form.LastSubmit.ID.

 

For the Variable passed through the Navigate () function, it is the same as the updateContext() function, which means the variable would be Reset once the screen has been nagivate away.

 

If you would like to keep the Variable value, then the value should be passed through the Navigate () again,

 

Or consider take use of the Set() function to generate a global Variable.

 

For more information about Variable in PowerApps, see:

Variables in PowerApps

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
New Member

Re: namecard Variable gets reset after SubmitForm()

Thanks a lot for your suggestion. This issue has borthed me so many days.

I can't believe it is solved by just using set() to pass the global varible. It works perfectly.

 

Have a great weekend!

 

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,643)