cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
Reply
Anonymous
Not applicable

Submitform resets toggles

Hello,

 

I have an EditForm that holds several data cards connected to a datasource (Dropbox table). Each datacard has a toggle. Once the toggle is checked a text input box becomes visible. When I check the toggles, input text and then press 'save' (Submitform), the toggles reset to 'off' mode, meaning that the text becomes invisibile again.  How can I stop the toggles resetting after I submit the form?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

You can use a Patch instead of submit for the form:

Patch(DataSourceName, Record, EditForm1.Updates)

But that still won't solve your problem if the toggle is inside the form (when the item is updated, the Item property of the form will be re-evaluated, causing the controls to be reset.

 

You can have the controls outside of a form (i.e., in the canvas directly), and use the Patch function as you would like - you'd just need to specify all the updates individually instead of relying on the form to collect them for you. In your case, it would be something like

Patch(
    DataSourceName,
    Record,
    {
        proteinDateCompleted: TotalProteinDateCompleted.Text,
        aminoAcidsDateCompleted: AminoAcidsDateCompleted.Text,
        ...
    })

Where 'proteinDateCompleted', 'aminoAcidsDateCompleted' are the names of the columns in your data source, and 'TotalProteinDateCompleted', 'AminoAcidsDateCompleted' are the name of the controls from where you're getting the values to update.

 

Your hacky solution wouldn't work - you want the toggle property to depend on the visibility of the TotalProteinDateCompleted control, but the visibility of that control depends on the toggle value. That creates a cycle that should be indicated as an error if you try to do that. The language of PowerApps is in many ways similar to a functional language - properties are defined as functions of other values, and if you have a property A defined as a function of B, and B defined as a function of A, that is inconsistent and is not allowed.

 

Another option you can consider is to store the visibility state of the toggles in your data source itself. For example, in addition to the column to store the date the total protein analysis was completed, you can have another property that indicates that the analysis has started (in which case you want to display the text input, with a possible blank value). Then you'd bind the default property of the toggle to that new column.

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @Anonymous

 

The toggles might reset for few reasons. Do you call ResetForm() anywhere? What are the default form mode? What are the Default property of each toggle? How do users navigate to the form? What is the function for text to be visible?

 

Can you share some screenshot as pictures is worth a thousand words when solving issues.

 

Anonymous
Not applicable

Hi @Anonymous, thank you for the reply.

 

In answer to your questions:

  • I do not (knowingly) call `ResetForm()` anywhere. I have scoured the app for this function but can't find it.
  • The form's default mode was 'new', I then changed it to `edit` but this didn't help.
  • The default property of the toggles is `false`. (Could this be the problem?)
  • The form is navigated to via an icon on the `BrowseScreen` with the function `Navigate(EditScreen1, ScreenTransition.None)`.
  • The function for the text to be visible is `If(Toggle1.Value = true, true)`.

It is worth noting that the text does not reset after using `SubmitForm()`, it is only toggles and check boxes that reset. This causes the text to become invisible, but the new text is still there when you check the toggles again.Deleteme.png

Whenever you submit a form, then all the controls are reset to their default values - and since the default value for the toggle is false, it will be unselected when you submit. This is the behavior of the form because there are many cases when after a submission is done, the data is changed in the server side (one example would be a SQL server trigger), so the form needs to display the most up-to-date information after the submission.

 

In your case you only have the toggle turned on when you have (or are adding) a value for the "date completed" field, correct? If this is the case, then you can set the toggle's default value to reflect that. Something along the lines of this expression for the Default property of the toggle:

 

!IsBlank(TotalProteinDateCompleted.Text) And !IsEmpty(TotalProteinDateCompleted.Text)
Anonymous
Not applicable

@CarlosFigueirathank you so much for this reply.

This is a great answer and very close to what I want. However, my idea was to check the toggles if that analysis was required (e.g. protein) and then enter the text in the date completed input box when the analysis was complete. So I would still like the toggles to remain checked even if the text boxes are empty (an example may be when one analysis has been completed but another has not).

Would a hacky option be to make the default property of the toggle something along the lines of:

IsVisible(TotalProteinDateCompleted.Text)

?

 

Sorry, I am not new to coding, just to Powerapps.

 

Otherwise, given the innate characteristics of the SubmitForm() function you described, do you think I may be better off using the Patch() function? I have tried this but have trouble figuring out what the formula should look like to submit a whole form.

 

Thank you

You can use a Patch instead of submit for the form:

Patch(DataSourceName, Record, EditForm1.Updates)

But that still won't solve your problem if the toggle is inside the form (when the item is updated, the Item property of the form will be re-evaluated, causing the controls to be reset.

 

You can have the controls outside of a form (i.e., in the canvas directly), and use the Patch function as you would like - you'd just need to specify all the updates individually instead of relying on the form to collect them for you. In your case, it would be something like

Patch(
    DataSourceName,
    Record,
    {
        proteinDateCompleted: TotalProteinDateCompleted.Text,
        aminoAcidsDateCompleted: AminoAcidsDateCompleted.Text,
        ...
    })

Where 'proteinDateCompleted', 'aminoAcidsDateCompleted' are the names of the columns in your data source, and 'TotalProteinDateCompleted', 'AminoAcidsDateCompleted' are the name of the controls from where you're getting the values to update.

 

Your hacky solution wouldn't work - you want the toggle property to depend on the visibility of the TotalProteinDateCompleted control, but the visibility of that control depends on the toggle value. That creates a cycle that should be indicated as an error if you try to do that. The language of PowerApps is in many ways similar to a functional language - properties are defined as functions of other values, and if you have a property A defined as a function of B, and B defined as a function of A, that is inconsistent and is not allowed.

 

Another option you can consider is to store the visibility state of the toggles in your data source itself. For example, in addition to the column to store the date the total protein analysis was completed, you can have another property that indicates that the analysis has started (in which case you want to display the text input, with a possible blank value). Then you'd bind the default property of the toggle to that new column.

Anonymous
Not applicable

@CarlosFigueirayes yes yes!

 

Your last idea of creating new columns in the datasource and binding the toggles to these works and is actually a smarter solution for my requirements. I am just wondering how I can do the reverse, so if I check a toggle in the app, how can I make this add text to the datasource cell (and therefore remain checked)? It can just be any text (e.g. "x") since your code just requires the cell to not be blank.

 

Thank you so much

If you have a column in the data source that identifies whether the value should appear (e.g., totalProteinAnalysisStarted), then you can go back to using forms - that should be easier than using the Patch manually (although using Patch isn't that much harder). In this case you would have another card in the form that would be bound to that new column. If you add it via the form customization pane, it will automatically set its default value to match the value of that column in the data source (assuming that the column is defined with type boolean / logic / yes/no / bit - depends on the data source).

 

If the type of the column is different (such as text), then you'd set the default property to an expression. For example, if you store an "X" if the toggle had previously been turned on (e.g., the total protein analysis has started), then the 'Default' property in the toggle would be set to totalProteinAnalysisStarted = "X".

 

 

If you want to go to the non-form route (which gives you greater flexibility over the design of the screen), then you can set the Default property of the toggle controls to the value to the property of the object being edited directly (if the type is boolean) or to an expression that returns a true/false value, like the example in the previous paragraph

Anonymous
Not applicable

@CarlosFigueiraafter much confusion and frustration, I found that your earlier suggestion of inserting the toggles directly onto the canvas (i.e. no form) and using the patch() function to save the changes to the datasource was the answer! I have accepted it as the solution.

Thank you sooooo much šŸ™‚ šŸ™‚ šŸ™‚

Helpful resources

Announcements

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome toĀ TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether youā€™re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community. Ā  As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure youā€™re well-versed in the communityā€™s pulse. Keep an eye on the News & Announcements for your weeklyĀ Tuesday Tipsā€”you never know what you may learn! Ā  This Week's Tip: Private Messaging & Macros in Power Apps Community Ā  Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Ā  Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros: Ā  Private Messaging: Learn how toĀ enable private messagesĀ in your community profile and ensure youā€™re connected with other community membersMacros Explained: Discover the convenience ofĀ macrosā€”prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps toĀ create your own macrosĀ for efficient communication within the Power Apps CommunityUsage Guide:Ā Understand how toĀ apply macrosĀ in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps:Ā Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate:Ā Enabling Private Messaging & How to Use Macros (Power Automate)Ā  Copilot Studio:Ā Enabling Private Messaging &How to Use Macros (Copilot Studio)Ā Power Pages:Ā Enabling Private Messaging & How to Use Macros (Power Pages)

April 4th Copilot Studio Coffee Chat | Recording Now Available

Did you miss the Copilot Studio Coffee Chat on April 4th? This exciting and informativeĀ session with Dewain Robinson and Gary Pretty is now available to watch in our Community Galleries! Ā  This AMA discussed how Copilot Studio is using the conversational AI-powered technology to aid and assist in the building of chatbots. Dewain is a Principal Program Manager with Copilot Studio. Gary is aĀ Principal Program Manager with Copilot Studio and Conversational AI. Both of them had great insights to share with the community and answered some very interesting questions!Ā Ā  Ā  As part of our ongoing Coffee Chat AMA series, this engaging session gives the Community theĀ unique opportunity to learn more about the latest Power Platform Copilot plans, where weā€™ll focus, and gain insight into upcoming features. Weā€™re looking forward to hearing from the community at the next AMA, so hang on to your questions! Ā  Watch the recording in the Gallery today: April 4th Copilot Studio Coffee Chat AMA

Tuesday Tip: Subscriptions & Notifications

TUESDAY TIPSĀ are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users. Ā  With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips! Ā  This Week: All About Subscriptions & Notifications We don't want you to a miss a thing in the Community! The best way to make sure you know what's going on in the News & Announcements, to blogs you follow, or forums and galleries you're interested in is to subscribe! TheseĀ subscriptionsĀ ensure you receive automated messages about the most recent posts and replies. Even better, there are multiple ways you can subscribe to content and boards in the community! (Please note:Ā if you have created an AADĀ (Azure Active Directory)Ā accountĀ you won't be able to receive e-mail notifications.) Ā  Subscribing to a CategoryĀ  When you're looking at the entire category, select from the Options drop down and choose Subscribe. Ā  Ā  You can then choose to Subscribe to all of the boards or select only the boards you want to receive notifications. When you're satisfiedĀ with your choices, click Save. Ā  Subscribing to a Topic You can also subscribe to a single topic by clicking SubscribeĀ from the Options drop down menu, while you are viewing the topic or in the General board overview, respectively. Ā  Ā  Subscribing to a Label Find the labels at the bottom left of a post.From a particular post with a label, click on the label to filter by that label.Ā This opens a window containing a list of posts with the label you have selected. Click Subscribe. Ā  Ā  Ā  Ā  Ā  Note:Ā You can only subscribe to a label at the board level. If you subscribe to a label named 'Copilot' at board #1, it will not automatically subscribe you to an identically named label at board #2. You will have to subscribe twice, once at each board. Ā  Bookmarks Just like you can subscribe to topics and categories, you can also bookmark topics and boards from the same menus! Simply go to the Topic Options drop down menu to bookmark a topic or the Options drop down to bookmark a board. The difference between subscribing and bookmarking is thatĀ subscriptionsĀ provide you with notifications, whereasĀ bookmarksĀ provide you a static way of easily accessing your favorite boards from theĀ My subscriptionsĀ area. Ā  Managing & Viewing Your Subscriptions & Bookmarks To manage your subscriptions, click on your avatar and select My subscriptions from the drop-down menu. Ā  Ā  From the Subscriptions & Notifications tab, you can manage your subscriptions, including your e-mail subscription options, your bookmarks, your notification settings, and your email notification format. Ā  Ā  You can see a list of all your subscriptions and bookmarks and choose which ones to delete, either individually or in bulk, by checking multiple boxes. Ā  Ā  A Note on Following Friends on Mobile Adding someone as a friend or selecting Follow in the mobile view does not allow you to subscribe to their activity feed.Ā You will merely be able to see your friendsā€™ biography, other personal information, or online status, and send messages more quickly by choosing who to send the message to from a list, as opposed to having to search by username.

Monthly Community User Group Update | April 2024

The monthlyĀ CommunityĀ User Group UpdateĀ is your resource for discovering User Group meetings and events happening around the world (and virtually), welcoming new User Groups to our Community, and more! Our amazing Community User Groups are an important part of the Power Platform Community, with more than 700 Community User Groups worldwide, we know they're a great way to engage personally, while giving our members a place to learn and grow together. Ā  This month, we welcomeĀ 3 new User GroupsĀ in India, Wales, and Germany, and featureĀ 8Ā User Group EventsĀ across Power Platform and Dynamics 365. Find out more below. New Power Platform User Groups Ā  Power Platform Innovators (India) About: Our aim is to foster a collaborative environment where we can share upcoming Power Platform events, best practices, and valuable content related to Power Platform. Whether youā€™re a seasoned expert or a newcomer looking to learn, this group is for you. Letā€™s empower each other to achieve more with Power Platform. Join us in shaping the future of digital transformation! Ā  Power Platform User Group (Wales) About: A Power Platform User Group in Wales (predominantly based in Cardiff but will look to hold sessions around Wales) to establish a community to share learnings and experience in all parts of the platform. Ā  Power Platform User Group (Hannover) About:Ā This group is for anyone who works with the services of Microsoft Power Platform or wants to learn more about it and no-code/low-code. And, of course, Microsoft Copilot application in the Power Platform. Ā  New Dynamics365 User Groups Ā  Ellucian CRM Recruit UK (United Kingdom) About:Ā A group for United Kingdom universities using Ellucian CRM Recruit to manage their admissions process, to share good practice and resolve issues.Ā  Ā  Business Central Mexico (Mexico City) About:Ā  A place to find documentation, learning resources, and events focused on user needs in Mexico. We meet to discuss and answer questions about the current features in the standard localization that Microsoft provides, and what you only find in third-party locations. In addition, we focus on what's planned for new standard versions, recent legislation requirements, and more.Ā Let's work together to drive request votes for Microsoft for features that aren't currently foundā€”but are indispensable. Ā  Dynamics 365 F&O User Group (Dublin) About: The Dynamics 365 F&O User Group - Ireland Chapter meets up in person at least twice yearly in One Microsoft Place Dublin for users to have the opportunity to have conversations on mutual topics, find out whatā€™s new and on the Dynamics 365 FinOps Product Roadmap, get insights from customer and partner experiences, and access to Microsoft subject matter expertise.Ā  Upcoming Power Platform EventsĀ  Ā  PAK Time (Power Apps Kwentuhan) 2024 #6 (Phillipines, Online)Ā This is a continuation session of Custom API. Sir Jun Miano will be sharing firsthand experience on setting up custom API and best practices. (April 6, 2024) Ā  Ā  Ā  Power Apps: Creating business applications rapidly (Sydney)Ā At this event, learn how to choose the right app on Power Platform, creating a business application in an hour, and tips for using Copilot AI. While we recommend attending all 6 events in the series, each session is independent of one another, and you can join the topics of your interest. Think of it as a ā€œHop On, Hop Offā€ bus! Participation is free, but you need a personal computer (laptop) and we provide the rest. We look forward to seeing you there! (April 11, 2024) Ā  Ā  April 2024 Cleveland Power Platform User Group (Independence, Ohio)Ā Kickoff the meeting with networking, and then our speaker will share how to create responsive and intuitive Canvas Apps using features like Variables, Search and Filtering. And how PowerFx rich functions and expressions makes configuring those functionalities easier. Bring ideas to discuss and engage with other community members! (April 16, 2024) Ā  Ā  Dynamics 365 and Power Platform 2024 Wave 1 Release (NYC, Online)Ā This session features Aric Levin, Microsoft Business Applications MVP and Technical Architect at Avanade and Mihir Shah, Global CoC Leader of Microsoft Managed Services at IBM. We will cover some of the new features and enhancements related to the Power Platform, Dataverse, Maker Portal, Unified Interface and the Microsoft First Party Apps (Microsoft Dynamics 365) that were announced in the Microsoft Dynamics 365 and Power Platform 2024 Release Wave 1 Plan. (April 17, 2024) Ā  Ā  Letā€™s Explore Copilot Studio Series: Bot Skills to Extend Your Copilots (Makati National Capital Reg...Ā Join us for the second installment of ourĀ Let's Explore Copilot Studio Series, focusing on Bot Skills. Learn how to enhance your copilot's abilities to automate tasks within specific topics, from booking appointments to sending emails and managing tasks. Discover the power of Skills in expanding conversational capabilities. (April 30, 2024) Ā  Upcoming Dynamics365 EventsĀ  Ā  Leveraging Customer Managed Keys (CMK) in Dynamics 365 (Noida, Uttar Pradesh, Online)Ā This month's featured topic: Leveraging Customer Managed Keys (CMK) in Dynamics 365, with special guestĀ Nitin JainĀ fromĀ Microsoft. We are excited and thankful to him for doing this session. Join us for this online session, which should be helpful toĀ all Dynamics 365 developers, Technical Architects and Enterprise architects who are implementing Dynamics 365 and want to have more control on the security of their data over Microsoft Managed Keys. (April 11, 2024) Ā  Ā  Stockholm D365 User Group April Meeting (Stockholm) This is a Swedish user group for D365 Finance and Operations, AX2012, CRM, CE, Project Operations, and Power BI.Ā  (April 17, 2024) Ā  Ā  Ā  Ā  Transportation Management in D365 F&SCM Q&A Session (Toronto, Online)Ā Calling all Toronto UG members and beyond!Ā Join us for an engaging and informative one-hour Q&A session, exclusively focused on Transportation Management System (TMS) within Dynamics 365 F&SCM. Whether youā€™re a seasoned professional or just curious about TMS, this event is for you.Ā Bring your questions! (April 26, 2024) Ā  Leaders, Create Your Events!Ā  Ā  Leaders of existing User Groups, donā€™t forget to create your events within the Community platform. By doing so, youā€™ll enable us to share them in future posts and newsletters. Letā€™s spread the word and make these gatherings even more impactful! Stay tuned for more updates, inspiring stories, and collaborative opportunities from and for our Community User Groups. Ā  P.S. Have an event or success story to share? Reach out to us ā€“ weā€™d love to feature you. Just leave a comment or send a PM here in the Community!

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

We have closed kudos on this post at this time. Thank you to everyone who kudo'ed their RSVP--your invitations are coming soon!Ā  MissĀ the window to RSVP? Don't worry--you can catch the recording of the meeting this week in the Community.Ā  Details coming soon! Ā  ***** Ā  It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT). Ā  Ā  This is an incredible opportunity to connect with members of the Copilot Studio product team andĀ ask them anythingĀ about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendarsĀ nowĀ because you will not want to miss the conversation. Ā  This live event will give you theĀ unique opportunity to learn more about Copilot Studio plans, where weā€™ll focus, and get insight into upcoming features. Weā€™re looking forward to hearing from the community, so bring your questions! Ā  TO GET ACCESS TO THIS EXCLUSIVE AMA:Ā Kudo this post to reserve your spot!Ā Reserve your spot now byĀ kudoing this post.Ā  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today. Ā  Invitations will be sent on April 2nd.Users posting KudosĀ afterĀ April 2nd. at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendarsĀ for April 3rd, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Blogging in the Community is a Great Way to Start

TUESDAY TIPSĀ are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users. Ā  With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips! Ā  This Week's Topic: Blogging in the Community Are you new to our Communities and feel like you may know a few things to share, but you're not quite ready to start answering questions in the forums? A great place to start is the Community blog! Whether you've been using Power Platform for awhile, or you're new to the low-code revolution, the Community blog is a place for anyone who can write, has some great insight to share, and is willing to commit to posting regularly! In other words, we want YOU to join the Community blog.Ā  Ā  Why should you consider becoming a blog author?Ā Here are just a few great reasons.Ā 🎉 Ā  Learn from Each Other: Our community is like a bustling marketplace of ideas. By sharing your experiences and insights, you contribute to a dynamic ecosystem where makers learn from one another. Your unique perspective matters! Collaborate and Innovate: Imagine a virtual brainstorming session where minds collide, ideas spark, and solutions emerge. Thatā€™s what our community blog offersā€”a platform for collaboration and innovation. Together, we can build something extraordinary. Showcase the Power of Low-Code: You know that feeling when you discover a hidden gem? By writing about your experience with your favorite Power Platform tool, youā€™re shining a spotlight on its capabilities and real-world applications. Itā€™s like saying, ā€œHey world, check out this amazing tool!ā€ Earn Trust and Credibility: When you share valuable information, you become a trusted resource. Your fellow community members rely on your tips, tricks, and know-how. Itā€™s like being the go-to friend who always has the best recommendations. Empower Others: By contributing to our community blog, you empower others to level up their skills. Whether itā€™s a nifty workaround, a time-saving hack, or an aha moment, your words have impact. So grab your keyboard, brew your favorite beverage, and start writing! Your insights matter and your voice counts! With every blog shared in the Community, we all do a better job of tackling complex challenges with gusto.Ā 🚀 Ā  Welcome aboard, future blog author!Ā āœļøāœļø🌠Ā Get started blogging across the Power Platform Communities today! Just follow one of the links below to begin your blogging adventure. Ā  Power Apps:Ā https://powerusers.microsoft.com/t5/Power-Apps-Community-Blog/bg-p/PowerAppsBlog Power Automate:Ā https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/bg-p/MPABlog Copilot Studio:Ā https://powerusers.microsoft.com/t5/Copilot-Studio-Community-Blog/bg-p/PVACommunityBlog Power Pages:Ā https://powerusers.microsoft.com/t5/Power-Pages-Community-Blog/bg-p/mpp_blog Ā  When you follow the link, look for the Message Admins button like this on the page's right rail, and let us know you're interested. We can't wait to connect with you and help you get started. Thanks for being part of our incredible community--and thanks for becoming part of the community blog!

Top Solution Authors
Top Kudoed Authors
Users online (6,665)