cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PingHouston
Level: Power Up

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})

image.pnglistscreen

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
PingHouston
Level: Power Up

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
Community Support Team
Community Support Team

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.
PingHouston
Level: Power Up

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 319 members 1,652 guests
Please welcome our newest community members: