The WHY
In this scenario, there is a need to add information to a list then when editing the information later they would like it to display different fields. When researching and looking for scenarios like mine, there wasn’t anything explaining how to do this with SharePoint Power Apps forms. Examples of this use case can be IT helpdesk portals, request portals for specific intranet sites (think of a specific request portal for Finance or HR where someone can request a site change or ask questions), FAQ portals… All of these lists would follow a similar structure where someone may be inputting information in a list but it may require additional steps after being submitted. In this case we are customizing a SharePoint list form to help showcase a solution like this.
The HOW:
The Foundation
- Create a list with the necessary metadata
- I’m still a bit old school, I will navigate to the backend of the list and create my columns there with no spaces then add the spaces after having created the columns. This helps with keeping your naming convention in tack, which helps when referring to columns and such within Power Apps but also the URL of the column itself is clean. On the contrary, using the modern interface to create columns it gives it a GUID like URL and keeps the Display Name as desired. There are reasons to use both but I have my personal preference! 🙂
- Add a Power Apps to the List
- Navigate to the list and click the Power Apps drop-down and click Customize Forms
- Power Apps will open and the first thing we can do is to rename the first screen
- Double click the screen name to make it editable and change the name to New_Screen and the form to New_Form
- In Power Apps, we try to use the KISS model.. (Keep It Simple…Silly)
- Shout out to my former co-worker who served in the National Guard for many many years, (Thank you for your service!) that helped drill the military version of the KISS model into my brain.
- Click save and publish to SharePoint
- Navigate to the List settings and Click Form Settings
- Ensure that the “Use a custom form created in Power Apps (requires a new list experience) – is checked
- Ensure that the “Use a custom form created in Power Apps (requires a new list experience) – is checked
- Let’s take a second to test and ensure everything is working with the form with the new Power Apps form in place.
- This will give us a base so if anything goes wrong later we will have a better understanding of what may have gone wrong:
- Test adding a new item
- Test viewing that item
- Test updating that item
- Now that we have tested and it is working let’s get to the fun part!
- Customize the SharePoint List Form
- Duplicate the New Screen 2 times – Which leaves you with 3 screens total
- With the 2 new screens, rename them to View_Screen and Edit_Screen
- Pro-Tip: Ensure that the New_Screen is the first in the list. Not crucial for this exercise but helps with visual logic while working with your screens and forms
- Rename the forms to View_Form and Edit_Form respectively
- Duplicate the New Screen 2 times – Which leaves you with 3 screens total
SharePointIntegration Settings:
- Click on SharePointIntegration and modify the settings as follows:
- OnNew: Navigate(New_Screen, ScreenTransition.None); NewForm( New_Form)
- OnEdit: Navigate(Edit_Screen, ScreenTransition.None); EditForm(Edit_Form)
- OnView: Navigate(View_Screen, ScreenTransition.None); ViewForm(View_Form)
- OnSave*: If(App.ActiveScreen.Name = “New_Screen”,SubmitForm(New_Form), App.ActiveScreen.Name = “Edit_Screen”,SubmitForm(Edit_Form))
- To edit which fields are showing in what order, click on the screen that you would like to update and click on the form control. Under the Edit panel, click the fields Edit Fields link. This will allow you to update the order, add or hide, and modify that specific form without changing the other screen forms.
- Now save and publish to SharePoint. The Power Apps forms and SharePoint Integration working together as one! I had a fun time working through this, I hope you did too!