cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate II

Issues with Form.UnSaved

Not sure if this is a bug or expected behavior, i have a form with a bunch of text boxes, lookups, dates etc all going back to an SQL database.

If i setup the form with dates, dropdowns (with the correct allowed values and defaults) the Form.Unsaved works correctly, make a change to a drop-down, updates = true, change back , updates = false. THe issue comes in with Text boxes. The fields in the database default to ('') and then are are varchar(5000). PowerApps will always report that the form has changes when it loads even if the field is blank. I found that if you add TrimEnds() to the default value of the data card (for example TrimEnds(ThisItem.Issue1) where issue1 is a field) then it works correctly. Anyone else come across something like this or am i missing something in the database setup?

 

Thanks!

25 REPLIES 25
Advocate I
Advocate I

So, it's been 21 Months since this bug was first reported, and it is still a problem in every single PowerApp that I write.

 

Seeing as PowerApps CORE functionality is the in the use of forms, I would expect a lot better from Microsoft.

 

Can we please have an update on when this BUG will be fixed?

 

 

Helper I
Helper I

 

I have been looking at this for a long time and I actually think this is not 1 bug but multiple ‘features’ of Power BI.

 

Every time I have encountered this issue (it has been 100s) I have found a route cause as to why Powerapps thinks the form has been edited and it usually relates to existing data at source.  I have found the offending attribute by creating a copy of the edit form and adding each attribute to the new form 1 at a time.  I also have a label/button that is visible when frm.unsaved.

 

Below is a summary of the causes and fixes I have seen whenever I open a record and immediately frmUNSAVED = True

 

Back end is SQL Database in all my example use cases

 

  1. Date Picker control default
    1. When the control used is a date picker and the source value is NULL or Empty Powerapps applies a “hidden” default to the control
    2. On the datepicker control ensure Advanced-->InputTextPlaceholder is empty

 

  1. DateTime column with HH:MM:SS format defined at source
    1. The DATETIME control in Powerapps only shows HH:MM so the app thinks it is updating the record by default as the seconds are being removed
    2. Need to change the control to Text box or change the format at source to not include seconds

 

  1. Drop down list/Combo where source database value is not in allowable list of values
    1. Update source to be valid item in your list of allowable values or add the missing value to list of allowable selections

 

  1. Drop Down list control where source data is NULL
    1. If you have a drop down list control but the source data is NULL/empty frm.saved will = true
    2. On the Drop down list ensure that Advanced-->AllowEmptySelection = True

 

  1. Float with more than 8 decimal places
    1. If you have a float that has more than 8 decimal places PowerApps trims the record and therefore the form thinks it is being updated
    2. Round at source to 8 or fewer decimal places, update source column to 8 or fewer decimal places

 

  1. Boolean attribute where source is null
    1. PowerApps Boolean selector only has 2 states (true/false) whereas SQL has 3 states (True/False/Null) and is not able to handle a null source attribute
    2. Change source to String with a TRUE/FALSE dropdown is the only fix I found, tried other controls but could not get it to work

 

  1. Empty string vs NULL
    1. I have found that Powerapps has set Unsaved = true if the source value is empty rather than NULL
    2. Set the source column to be Null

 

If i find or think of any more i will update this post.

Thanks Apsmith2

 My Form datasource is SharePoint with the same issue Form.Unsaved = true, even in View mode.

 Your hints worked all the magic.

 

Thank you

This very valuable, thanks a lot. It makes this rather weird behavior more understandable.

Frequent Visitor

I have stumbled on a quick and dirty fix for this problem (since it doesn't appear that MSFT seems to care much about fixing this on their end).  It may be of help to some of you.

 

In the ONVISIBLE property of your EditScreen1:  start it off with ResetForm(EditForm1);

 

This appears to reset the 'Form.Unsaved' back to false, and allows your form to contain customized defaults without impacting this result.

Frequent Visitor

I was having similar problems, even just after I had issued a "SubmitForm(frmName)" command using a save button, the form still claimed it was unsaved.  However I have one fix that hasn't been mentioned.  The default setting for an edit forms Item property is often set to another forms/gallery/Data tables Selected property (classic master/detail, you select a something from the Master form, it shows it's details in the detail).  Instead of using this, try setting the Item value to a filtered list of the SQL table, based on the ID of the selected item.  For me this means the Edit forms Item value is set to:
First(Filter('[metadata].[action]',id=datSelectAction.Selected.id))

For some reason this slight disassociation results in the Unsaved being evaluated correctly.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (77,246)