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

Change DatacardValue from Default Doesn't Save

Hi all,

 

I'm customising a SharePoint List Form(List 1), I added another screen that opens an edit form to another list(List 2).  On the button I use to Navigate I use the context to pass the value of a field from List 1 to a Field on the List 2 form.  This all works fine and the Edit Form for list 2 opens with the Value from List 1.

 

But when I submit the form, all the fields values are submitted to List 2 apart from this one value that I have changed the "Default" property.

 

Can anyone give me an idea of where I'm going wrong?

 

Thanks...

 

John

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Change DatacardValue from Default Doesn't Save

I think I understand your issue better now, thanks for providing the screenshots. You're currently passing a control as the context parameter to the Navigate function. If you pass the value, then I believe my approach should work. On the Add Action OnSelect property you'd have something like

Navigate(Screen1, ScreenTransition.Fade, { sc1Text: DataCardValue2.Text })

Then the value of the context variable 'sc1Text' now contains the text for the value, that can be updated.

 

In the add action form's OnSuccess property, you'd then update the value again:

UpdateContext({ sc1Text: AddActionForm.LastSubmit.EcnId })

If this works, great. If it doesn't, can you let us know what type of card you had for the ECN ID - did you change the control type, did you change any properties? Also, what is the type of the EcnId column in the second list?

View solution in original post

6 REPLIES 6
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Change DatacardValue from Default Doesn't Save

Whenever a form is submitted, the values for all fields are reset to their default values. That is because when you submit an item, it's possible that some of the values are changed in the data source itself (some server-calculated column).

 

If you changed the default value of a card based on some variable (from a different form), then you can update that variable after a successful submission, so that the value is shown after the form is submitted. For example, if the variable is called 'ValueFromFormA', which is used as the default for the column 'ColFromA', you can set the following expression on the OnSuccess property of the list 2 form:

UpdateContext({ ValueFromFormA: Form1.LastSubmit.ColFromA })
BigJohn
Level: Powered On

Re: Change DatacardValue from Default Doesn't Save

 @CarlosFigueira

 

Thanks for the quick reply!  

 

I don't think that's the issue here however.  Here are some screenshots which may help:

 

screen_1.JPGOn the screen_2.JPG

On the "OnSelect" of the "Add Action" Button at the top of the first screen I use this:

Navigate(Screen1,ScreenTransition.Fade, { sc1Text: DataCardValue2 } )

Then on the Default of the ECN ID card I use sc1Text.Text As you can see the value gets displayed.  However, when I click the tick at the top of the second screen to submit the form, the value doesn't get saved to the SharePoint list.  The other data does get stored.

 

Apologies if I've misunderstood your respone, and your help is greatly appreciated!

 

Cheers...

 

John

Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Change DatacardValue from Default Doesn't Save

I think I understand your issue better now, thanks for providing the screenshots. You're currently passing a control as the context parameter to the Navigate function. If you pass the value, then I believe my approach should work. On the Add Action OnSelect property you'd have something like

Navigate(Screen1, ScreenTransition.Fade, { sc1Text: DataCardValue2.Text })

Then the value of the context variable 'sc1Text' now contains the text for the value, that can be updated.

 

In the add action form's OnSuccess property, you'd then update the value again:

UpdateContext({ sc1Text: AddActionForm.LastSubmit.EcnId })

If this works, great. If it doesn't, can you let us know what type of card you had for the ECN ID - did you change the control type, did you change any properties? Also, what is the type of the EcnId column in the second list?

View solution in original post

BigJohn
Level: Powered On

Re: Change DatacardValue from Default Doesn't Save

Thanks again for your help @CarlosFigueira

 

When I add 

UpdateContext({ sc1Text: AddActionForm.LastSubmit.EcnId })

To the OnSuccess of the AddActionForm I get the following error.

 

"The types of the specified context variablesare incompatible with the types specified elsewhere"

 

The ECN ID Column in SharePoint is a Single Line of Text, although when within PowerApps it was of type Number so I changed it to Text.

 

Thanks again...

 

John

BigJohn
Level: Powered On

Re: Change DatacardValue from Default Doesn't Save

Hi @CarlosFigueira

 

I decided to start from scratch and follow your instructions and it's now working.  Disappointed that I'm not entirely sure what I changed in the first instance to make it not work, but at least we got there in the end.

 

Thank you very much for all your assistance.

 

Cheers...

 

John

Community Support Team
Community Support Team

Re: Change DatacardValue from Default Doesn't Save

Hi @BigJohn,

 

Thanks for the update.

If convenient, could you please Accept the proper response from Staff CarlosFigueira as the solution?

 

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.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,202)