cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mdevaney
Community Champion
Community Champion

Unsaved Property of Edit Form Is Always True

The Unsaved property of my Edit Form form always has a value of true, even when I have made no changes. My form is in FormMode.Edit.

 

As a test I created a button with this code in the OnSelect property.  The Edit Form still shows Unsaved as true after I click the button

 

ResetForm(Form1);

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

24 REPLIES 24
ahoepfner
Regular Visitor

@mdevaney@WarrenBelz@v-bofeng-msft@Avinoam@james_hathaway@subsguts@mmook@appyourdata@biterbit@sguthrie1@Matren 

(This is my first post and I don't know etiquette. I tagged everyone on this post to make sure you would see this potential solution.) 

 

I made a major breakthrough on this issue yesterday. I haven't completely solved it - there's still one form giving me issues. But I think I'm headed down the right path. I wanted to see if posting my solution would help anyone else and if maybe someone could help me with this one last form I'm having trouble with.

 

I created what is basically an HR app for our managers to track monthly check ins with each of their employees. This is a canvas app using Dataverse for the data. Each table allows entries to be tracked by date, and there is a table for pretty much every question: how can our company better support you; do you need additional tools and resources for your job; what is your definition of success; etc. I have a pop-up that comes up when someone tries to navigate to a new page without saving their edits or their new entry first. I have this tied to the "Unsaved" property of each form. 

 

All of my forms have a hidden lookup field to link the entries to one employee from the Dataverse User table. This was the first field that was affecting the "Unsaved" property. My lookup formula is in the Default property of the user lookup data card. I added an If statement so that it only does the lookup if the FormMode is New. If the FormMode is Edit or View, it shows the existing entry. This solved the issue for all of those tables with just the one hidden field.

 

I was still having issues with one large table that has two additional hidden fields. On this screen, I have ten different forms that all link to one master table. One of the hidden fields selects one of five dropdown items ("Pillars") depending on what is visible on the screen at the time, and the other hidden field selects whether or not the entry is in a supervisor or employee form, based on which form it is entered in. I tried adding my If statement on these but couldn't get it to work. I was pretty sure it was the syntax I was using and finally figured it out yesterday. I'm still fairly new to Power Apps, and I realize that there are likely better ways of solving this, which is another reason I wanted to post it here.

 

My Pillar field is a lookup to a Dataverse Choice table. In the PillarDataCard default, I just have ThisItem.Pillar. In the DataCardValue, in Items, I have Choices(chPillarChoices) and in DefaultSelectedItems, I have 

If('frmIntegrity-Emp'.Mode=FormMode.New, Filter(Choices(chPillarChoices), Value=chPillarChoices.Integrity), [Parent.Default]). I originally was trying "ThisItem.Pillar" instead of [Parent.Default], and that still wasn't working. I tried "Parent.Default" without the brackets, but that wasn't working either. I happened to notice that another combobox had brackets around "Parent.Default" that identified it as a table instead of a record. As soon as I added the brackets around it to make it [Parent.Default], my unsaved property worked!

 

My Yes/No Supervisor field was similar, but the syntax was slightly different. In the DefaultSelectedItems for the DataCardValue, I ended up with this: 

If('frmIntegrity-Emp'.Mode=FormMode.New, Filter(Choices('Supervisor Comment (chPillars)'),Value='Supervisor Comment (chPillars)'.No), [Parent.Default])

 

What I think was happening, when my forms would open to an EditForm with an existing entry, those default values were overwriting what was already in the table, even though they were the same value. So it was triggering the Unsaved even though there were no visible changes. 

 

As I said, I still have just one table that is giving me issues. It's built almost identically to another table that is working just fine, and I can't seem to find where it's getting tangled up at. But after getting the Unsaved property to work everywhere else in my app, I'm feeling confident that I'll find it eventually. It does have one other Yes/No combobox - I don't have default set in the app, but I'm wondering if the default "no" that pushes from Dataverse is affecting this and I'm going to try to add an If statement similar to what I have in my SupervisorDataCard to see if that fixes it (weird that my other form with a similar combobox is NOT giving me issues though).

 

I hope this helps someone! I am still learning Power Apps and feel like I kind of flail around searching Google for solutions to cobble together for my unique situation. I was pretty excited to have found a fix for the Unsaved property and wanted to share it to see if this community could use it and build on it.

 

Thank you!

 

Amy

Be wary of this because Unsaved doesn't not work all the time.  The reason not to use it is that it can't be TRUSTED and probably never will based on the time it's been and nothing has been done to resolve it.  

As someone else mentioned, I have a big manual comparison between every field on the screen and the original datasource.  However, even that can sometimes fail if you are using combo boxes and other things that get loaded from a source that isn't quick.  The reason being is because during the load, that second or less, the values between the datasource and the screen will be different, so you can get a flash of the "Save" button being available.  Very annoying...  So you have to sometimes rework, as I did, your combos to work off of collections to avoid going to the server.  Again, shouldn't be this hard.

Only other way is just to ask the user the annoying, "Are you sure you want to leave, you may have made changes?".  I noticed that even PowerApps does this when you haven't made any changes, so that's the approach MS has taken.  I don't like it and prefer the system to let the user know immediately that they just changed something that needs to be saved if they don't want to lose it and then I even force them to click a Cancel Changes icon.  Of course they can leave the App, nothing I can do to prevent that.

 

Hope this is helpful.

Gurdy
Regular Visitor

My solution:
i set a global variable: isFromChanged.
In every textfield or combobox which is relevant, i do an UpdateContext in the OnChange-value:
UpdateContext({isFormChanged: true}).
For me it works to set the visibility or displaymode or color of a save-button for example.
Enjoy.

I believe this won't be triggered until you leave the "textfield" so it won't trigger until you move to the next field.  I could be wrong.  Not saying it won't work, but if you start typing a change to say a "Descripition:" field, I'm not sure it will know anything has changed if you exit the screen before leaving the field.

gregmck
Advocate I
Advocate I

Came across this thread while trying to build a Template App and experiencing the .Unsaved issue.

 

Adding a label to view the Form's Unsaved value really does lead to some pretty remarkable true / false returns, for no apparent or logical reason.

 

Not sure if this helps, but the simplest workaround I've found is to check if the User has clicked an UpdateContext link, on their way to the Form, where editMode or newMode have become "true". If so, a Save button / icon can effect the changes; a Cancel button / icon can reset the modes.

 

Navigation away from the screen is dependent on an And(!editMode, !newMode) condition. If true, navigate. If false, check the .Unsaved property (pretty much as a last resort!). The DisplayMode of the navigation icon is also 

Or(editMode, newMode)-dependent.
 
Basically, use a Form, but ensure that the User is forced to either Save or Cancel, and make sure the correct contexts are set.

Helpful resources

Announcements

Check Out the February 2024 Dynamics 365 Newsletter

Some of our most active Power Platform Community members are also active in our D365 Community. This month, we are excited to share the latest news from the D365 Community with you.   Our Dynamics365 Community has updated yet again! Since launching in June of 2023, the new Community has seen consistent updates and exciting new ways to feature and celebrate its members. In the latest edition of the Dynamics365 Community newsletter, you can see the new Leaderboard feature! This feature showcases which Community members have earned the most points over the previous month, enabling them to see how they are doing with their engagement--and their progress toward Super User status. Visit the leaderboard for yourself: https://aka.ms/d365clb     Read the whole newsletter featuring the new leaderboard as well as the D365 Monthly Community Member spotlight, FastTrack Tech Talks, upcoming events, and more. February 2024 Dynamics 365 Community Newsletter

Celebrating a New Season of Super Users with Charles Lamanna, CVP Microsoft Business Applications

February 8 was the kickoff to the 2024 Season One Super User program for Power Platform Communities, and we are thrilled to welcome back so many returning Super Users--as well as so many brand new Super Users who started their journey last fall. Our Community Super Users are the true heroes, answering questions, providing solutions, filtering spam, and so much more. The impact they make on the Communities each day is significant, and we wanted to do something special to welcome them at our first kickoff meeting of the year.   Charles Lamanna, Microsoft CVP of Business Applications, has stressed frequently how valuable our Community is to the growth and potential of Power Platform, and we are honored to share this message from him to our 2024 Season One Super Users--as well as anyone who might be interested in joining this elite group of Community members.     If you want to know more about Super Users, check out these posts for more information today:    Power Apps: What is A Super User? - Power Platform CommunityPower Automate: What is A Super User? - Power Platform Community Copilot Studio: What is A Super User? - Power Platform Community Power Pages: What is A Super User? - Power Platform Community

February 2024 User Group Update: Welcoming New Groups and Highlighting Upcoming Events

It's a new month and a brand-new year, which means another opportunity to celebrate our amazing User Groups!Each month, we highlight the new User Groups that have joined the community. It's been a busy season for new groups, because we are thrilled to welcome 15 New User Groups! Take a look at the list below, shared by the different community categories. If your group is listed here, give this post a kudo so we can celebrate with you!   We love our User Groups and the difference they make in the lives of our Community! Thank you to all the new User Groups, new User Group leaders--we look forward to hearing about your successes and the impact you will leave!   In addition to our monthly New User Group spotlight, it's a great time to share some of the latest events happening in our User Group community! Take a look at the list below to find one that fits your schedule and need! There's a great combination of in-person and virtual events to choose from. It's a great time of year to connect and engage with User Groups both locally and online. Please Welcome Our NEW User Groups   Power Platform: Heathcare Power Platform User Group Power Platform Connect Hub Power Platform Usergroup Denmark Mexico Norte- Power Platform User Group Pune Power User Group Sudbury Power Platform User GroupMicrosoft User Group GhanaMPPBLR - Microsoft Power Platform Bengaluru User Group Power Apps:   Myrtle Beach Power Platform User GroupAnanseTechWB PowerApps Copilot Studio: Pathfinders Power Platform Community Dynamics365: Cairo, Egypt MSD 365 Business Central/NAV/F&O User GruopMS Dynamics 365 Business Central LatamCincinnati OH D365 F&O User Group February User Group Events February 2024 Cleveland Power Platform User GroupPortallunsj - Februar 2024Indiana D365/AX February User Group MeetingQ1 2024 KC Power Platform and Dynamics 365 CRM Users Group 

Super Users 2024 Season One is Here!

   We are excited to announce the first season of our 2024 Super Users is here! Our kickoff to the new year welcomes many returning Super Users and several new faces, and it's always exciting to see the impact these incredible individuals will have on the Community in 2024! We are so grateful for the daily difference they make in the Community already and know they will keep staying engaged and excited for all that will happen this year.   How to Spot a Super User in the Community:Have you ever written a post or asked for help in the Community and had it answered by a user with the Super User icon next to their name? It means you have found the actual, real-life superheroes of the Power Platform Community! Super Users are our heroes because of the way they consistently make a difference in the Community. Our amazing Super Users help keep the Community a safe place by flagging spam and letting the Community Managers know about issues. They also make the Community a great place to find answers, because they are often the first to offer solutions and get clarity on questions. Finally, Super Users share valuable insights on ways to keep the Community growing, engaging, and looking ahead!We are honored to reveal the new badges for this season of Super Users! Congratulations to all the new and returning Super Users!     To better answer the question "What is a Super User?" please check out this article: Power Apps: What is A Super User? - Power Platform CommunityPower Automate: What is A Super User? - Power Platform Community Copilot Studio: What is A Super User? - Power Platform Community Power Pages: What is A Super User? - Power Platform Community

January 2024 Community Newsletter

Welcome to our January Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members. If you're new to the Community, please make sure to follow the latest News & Announcements in each Community and check out the Community on LinkedIn as well! It's the best way to stay up-to-date in 2024 with all the news from across Microsoft Power Platform and beyond.      COMMUNITY HIGHLIGHTS Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, giving (and receiving!) kudos, and consistently providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, make it your New Year's Resolution to be more active in the community in 2024.   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzWarrenBelzPstork1saudali_25LaurensMPstork1stephenrobertLucas001AARON_ClbendincpaytonSurendran_RANBNived_NambiarMariamPaulachanNikhil2JmanriqueriosANBJupyter123rodger-stmmbr1606Agniusstevesmith27mandelaPhineastrice602AnnaMoyalanOOlashynBCLS776grantjenkinsExpiscornovusJcookSpongYeAARON_CManishSolankiapangelesPstork1ManishSolankiSanju1Fubar   LATEST NEWS Power Platform 2024 Release Wave Highlights This month saw the 2024 Release Wave 1 plans for Microsoft Power Platform and Microsoft Dynamics 365- a compilation of new capabilities planned for release between April and September 2024. Click here to read Corporate Vice President Maureen (Mo) Osborne's detailed breakdown of the upcoming capabilities, and click the image below to check out some of the Power Platform 2024 Release Wave 1 highlights.     "What's New" Power Platform Shorts Series This month we also launched our brand-new 'Power Shorts' series on YouTube - a selection of super sweet snapshots to keep you in the loop with all the latest trends from across the Power Platform and beyond. Click the image below to check out the entire playlist so far, and don't forget to subscribe to our YouTube channel for all the latest updates.   Super User In Training (S.U.I.T) It was great to see the Power Platform Community officially kick off Season One of their Super User in Training (SUIT) program this month! Their first meeting saw an amazing turnout of over 300 enthusiastic participants who started their dynamic journey toward becoming Super Users. Huge thanks to Manas Maheshwari, Eric Archer, Heather Hernandez, and Duane Montague for a fantastic kick-off. The first meeting also saw seasoned Super User, Drew Poggemann, share invaluable insights on navigating the #MicrosoftCommunity with finesse. Many thanks to Drew for setting the stage and emphasizing the importance of active engagement and the art of providing thoughtful community solutions. If you want to learn more about the features and benefits of gaining Super User status, click the image below to find out more, and watch this space for more info about Season Two and how you can SUIT UP in the community!     UPCOMING EVENTS Microsoft 365 Community Day - Miami - February 1-2, 2024 It's not long now until the Microsoft 365 Community Day Miami, which will be taking place at the Wolfson Campus at Miami Dade College on 1-2 Feb. 2024. This free event is all about unlocking the full potential of Power Platform, Microsoft 365, and AI, so whether you’re a tech enthusiast, a business owner, or just curious about the latest Microsoft advancements, #M365Miami is for you.   The event is completely free and there will sessions in both English and Spanish to celebrate the vibrant and diverse make-up of our amazing community. Click the image below to join this amazing Community Day in Miami and become a part of our incredible network of learners and innovators!     Microsoft Fabric - Las Vegas - March 26-28, 2024 Exciting times ahead for the inaugural #MicrosoftFabric Community Conference on March 26-28 at the MGM Grand in Las Vegas. And if you book now, you can save $100 off registration! The Microsoft Fabric Conference will cover all the latest in analytics, AI, databases, and governance across 150+ sessions.   There will be a special Community Lounge onsite, interactive learning labs, plus you'll be able to 'Ask the Experts' all your questions to get help from data, analytics, and AI specialists, including community members and the Fabric Customer Advisory Team. Just add the code MSCUST when registering for a $100 discount today. Click the image below to find out more about the ultimate learning event for Microsoft Fabric!     Microsoft 365 Conference - Orlando - April 30 - May 2, 2024 Have you added The Microsoft 365 Conference to your community calendar yet? It happens this April 30th - May 2nd in Orlando, Florida. The 2024 Microsoft 365 Conference is one of the world’s largest gatherings of Microsoft engineers and community, with a strong focus on Power Platform, SharePoint, Azure, and the transition to an AI-powered modern workplace.   Click the image link below to find out more and be prepared to be enlightened, educated, and inspired at #M365Conf24!   LATEST COMMUNITY BLOG ARTICLES Power Apps Community Blog Power Automate Community Blog Copilot Studio Community Blog Power Pages Community Blog Check out 'Using the Community' for more helpful tips and information: Power Apps, Power Automate, Copilot Studio, Power Pages  

Did You Attend the Microsoft Power Platform Conference in 2022 or 2023? Claim Your Badge Today!

If you were one of the thousands of people who joined us at the first #MPPC Microsoft Power Platform Conference in 2022 in Orlando--or attended the second-annual conference in Las Vegas in 2023--we are excited to honor you with a special community badge! Show your support for #MPPC Microsoft Power Platform Conference this year by claiming your badge!         Just follow this link to claim your badge for attending #MPPC in 2022 and/or 2023: MPPCBadgeRequest    Want to earn your badge for 2024? Just keep watching our News & Announcements for the latest updates on #MPPC24.

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