Want to learn how to manipulate the different form modes within Power Apps? In this episode of Power Platform Quick Tips, I’ll show you how to manipulate and use the different form modes when leveraging the native forms in Power Apps. I’ll also show you how to apply them inside of different dynamic capabilities in Power Apps.
- My focus is on a header in an appointment app for pet care that I created in Power Apps. I want to make this header change dynamically based on the form mode that we’re in.
- Whenever you’re working with forms, especially when working with a default behavior in Power Apps, you have one edit screen that uses one form.
- But that same edit screen and same form can be relaunched in different modes. You can have it launch in a new mode, which means it’s going to insert a record. Or you can launch it in an edit mode which means it will edit a record.
- In my example, I have an app where I can add a new appointment or edit an existing one. The problem is my header always reads ‘Add Appointment’ whether I’m adding a new one or editing an existing one. I want to make this more dynamic.
- To do this we can click on the header and manipulate it to return different results. You can do this with an ‘If’ statement (like what you’d do in Excel if you’re familiar with that).
- Be sure to check out my video below to see the exact code to do this. But basically, I want to do an ‘If’ statement saying if the mode = new, then the app should launch ‘Add a New Appointment’ in the header.
- If it’s not in new mode but in edit mode, then I want to have it return something more dynamic. I’ll add the code to launch the header as ‘Edit the Appointment For’.
- I want that sentence to end dynamically with whatever appointment I’m in, so I add an &. I want it to pull back a value from whatever we have selected in the gallery. After the &, I put in my gallery name and then selected, and have it return the pet name column. So, my header would read ‘Edit the Appointment For Spot’ for example.
- Now when I interact with this app, the form below the header stays the same but the header changes dynamically for adding or editing an appointment.
What I did today was set the header text in my app to change based on whatever mode my form is in when it is launched. The code was quite simple to do this, and you can see it on my video.
If you have any other things you’d like to see a quick tip for within the Power Platform, be sure to add it in the comments section. If you’re looking for more Power Apps training, our On-Demand Learning platform has Power Apps and Power Platform courses as part of our 55+ library of courses. A great place to begin is with our FREE App in a Day course - that’s right, I said FREE. Click below to subscribe to your free course today!