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

Show what fields have changed in a form. Unsaved state persists after OnSuccess()

I have a somewhat convoluted form with some defaults being set when the form appears, i thought this was the reason for the persistent unsaved property for the form, but it seems to be something else. I'd like to create an option that automatically saves eventually, but only want to give the user an indication that the document is saved to begin with. This is currently done with making an icon visible when the form Unsaved is false. 

 

Could it be that OnSuccess does not reset the Unsaved property?. I was thinking it was highly probable that one of my fields have some issue because of some custom default-values being set based on values in other fields etc, but I have tried disabling and removing all custom fields without success.

 

I'd like to understand what field or mechanic that is causing the persisting unsaved-state, this also got me thinking that it could be useful to make some indication on the fields that are changed and unsaved. I can always make use of the OnChange function, but I imagine there is a better solution. Perhaps there is another way to solve this, however i cannot find the values that trigger the unsaved state to determine the best way to proceed.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Show what fields have changed in a form. Unsaved state persists after OnSuccess()

Hi @hjaf,

 

Could you please share a bit more about your scenario?

Do you mean that the form data could not be saved into your data source when your submit the form (Using SubmitForm function)?

 

I don't agree with @Drrickryp's thought. I have made a test on my side, when the Edit form control is in New mode, the EditForm1.Unsaved formula would always return false, regardless of whether or not there is a default for any field. The GIF Screenshot as below:Test1.gif

 

 

The UnSaved property (of Edit form control) would return true only when the Edit form control contains user changes that have not been saved.

 

More details about the UnSaved property of the Edit form control, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail#key-proper...

 

In addition, the OnSuccess property of the Edit form control would not reset the UnSaved property automatically in default (except that you add formula to force resetting the Edit form, then the UnSaved property would be reset).

 

I also made a test on my side, after I submit the form, the UnSaved property still return true. It means that the UnSaved property of the Edit form is not reset after you submitted the form (Just as you thought).

 

As an alternative solution, if you want to the OnSaved property to be reset after you submit your form, please take a try with the following workaround:

 

Set the OnSelect property of the "Submit" button to following formula:

 

SubmitForm(EditForm1);
ResetForm(EditForm1) /* <-- Add this code to force resetting the Edit form */

 

Or

 

Add the following formula within the OnSuccess property of the Edit form:

ResetForm(EditForm1)

 

Note: The Editform1 represents the Edit form control within your app.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Show what fields have changed in a form. Unsaved state persists after OnSuccess()

Hi @hjaf,

I was trying to reproduce your situation and could not do it as long as the form is in Edit mode. However, when the form mode is new, it automatically assumes that it is unsaved, regardless of whether or not there is a default for any field.  I tested this by setting the Visibiility property of the Save button to Form1.Unsaved and it was always visible when the Form mode was new.  If was never visible when the Form mode was Edit until one of the fields was changed.  

hjaf
Level: Powered On

Re: Show what fields have changed in a form. Unsaved state persists after OnSuccess()

That is really strange, i have confirmed that the editmode is Edit using a label for that as well. Only if i change the lookup field to view in the editor the unsaved property becomes false. This is a somewhat convoluted form, could be that i have some fields with defaults referring to the lookup field. But its still somewhat strange that it depends on the lookup-field being in editable or not. 

Community Support Team
Community Support Team

Re: Show what fields have changed in a form. Unsaved state persists after OnSuccess()

Hi @hjaf,

 

Could you please share a bit more about your scenario?

Do you mean that the form data could not be saved into your data source when your submit the form (Using SubmitForm function)?

 

I don't agree with @Drrickryp's thought. I have made a test on my side, when the Edit form control is in New mode, the EditForm1.Unsaved formula would always return false, regardless of whether or not there is a default for any field. The GIF Screenshot as below:Test1.gif

 

 

The UnSaved property (of Edit form control) would return true only when the Edit form control contains user changes that have not been saved.

 

More details about the UnSaved property of the Edit form control, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail#key-proper...

 

In addition, the OnSuccess property of the Edit form control would not reset the UnSaved property automatically in default (except that you add formula to force resetting the Edit form, then the UnSaved property would be reset).

 

I also made a test on my side, after I submit the form, the UnSaved property still return true. It means that the UnSaved property of the Edit form is not reset after you submitted the form (Just as you thought).

 

As an alternative solution, if you want to the OnSaved property to be reset after you submit your form, please take a try with the following workaround:

 

Set the OnSelect property of the "Submit" button to following formula:

 

SubmitForm(EditForm1);
ResetForm(EditForm1) /* <-- Add this code to force resetting the Edit form */

 

Or

 

Add the following formula within the OnSuccess property of the Edit form:

ResetForm(EditForm1)

 

Note: The Editform1 represents the Edit form control within your app.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 354 members 6,019 guests
Please welcome our newest community members: