SharePoint is great at managing an organizations content and its metadata using fields and content types. For those who are new to SharePoint and information architecture, Content Types are a way to describe a specific type of item and contain the description about the item (metadata fields).
The out-of-the-box SharePoint form experience can be customized using Power Apps, whereby many of the great features of Power Apps can be used to give the user a much better experience. However, by default, the customized SharePoint form does not handle the content types. This is something that needs to be done manually by the app developer to ensure that the data is correctly entered.
Setting up the content types
To set up a custom content type in a SharePoint list, you need to follow the following steps:
- Create a new list/library in a SharePoint site
- Create content types with fields to hold the metadata
- Associate the content type to the list/library
Your list is now ready to store metadata in it for the various content types
Setting up the Customized Form
The first step is to customize the form via the Integrate → Power Apps → Customize forms menu
Inside the maker portal, you will have access to modify the form to your specific needs. In order to set the content type, you need to edit the list of fields and show the Content Types available.
The content types will appear as a drop-down.
As you continue to add the fields into the form, they will be laid out on the page so the user can fill in the data. To avoid confusion, you will need to check the content type that is selected and display only the fields that are relevant to it. For example, if your Cereal content type has a choice field called Grains then you should only show it when the user selects that content type. Similarly, if Soup content type includes a choice field for Type of meat/poultry, that one doesn’t apply to Cereal. So, if the content type drop down is called DataCardValue2 (ideally, you should rename it to something more meaningful), the visibility of the other data cards will be based on
DataCardValue2.Selected.Name = "Soup"
DataCardValue2.Selected.Name = "Cereal"
As you saw in the image above, when creating a SharePoint new item, you can select the type of item you are creating.
However, this selection is not transferred into the custom Power App form, requiring the user to manually select it in the form.
This blog is part of SharePoint Week. Find more here.
About the Author:
Father, husband, Microsoft MVP, Enterprise Architect at Protiviti, PowerAddict, FlowFam member, always want to learn new things, so ask me anything.
Croitoru, H. (2022). Customizing your Power Apps SharePoint Forms for Content Types. Available at: https://regarding365.com/customizing-your-power-apps-sharepoint-forms-for-content-types-a14b5377f241 [Accessed: 28 April 2022].