cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ShriramP
Advocate II
Advocate II

SharePoint Content Types in PowerApps Form - A Workaround!

Microsoft has not yet provided support to handle SharePoint List Content Types through Power Apps. There is still one idea "under review" to Microsoft.

 

SharePoint Modern OOB List form already supports handling of multiple Content Type forms. But if we want to have Customized view of the SharePoint form then Power Apps doesn't support it yet. And though InfoPath support's it in SharePoint Online, this product is approaching end of its lifecycle.

 

So, to make it working in Power Apps (similar like SharePoint Modern OOB List Form), here is a custom workaround.

 

Please follow the steps one by one as mentioned below. Please note, these steps expect you to have intermediate level of expertise in Power Apps and Modern SharePoint Online.


SharePoint Modern List Configuration

 

- Create modern list named "test" in any of your test site collection.
- In List Advanced Settings, Allow management of content types.
- Add one more existing content type as "Comment" to the List (along with default Item content type)
- Assign default value “hello” to OOB Title column
- Add non-mandatory single text column "CustomContentType" for storing Content Type value (add to all content types, add to default view).
- Add 3 (non-mandatory) single text columns TestColumn1, TestColumn2, TestColumn3 (add to all content types, add to default view).


(The reason that we need to have all columns as non-mandatory columns in SharePoint is that OOB SharePoint save action will not be execute if other Content Type Power Apps forms have mandatory columns. Instead we can make needed fields as mandatory in Power Apps)

- These 4 new columns will be visible in both "Item" and "Comment" List content type
- Remove "TestColumn2" and "TestColumn3" column from Item List Content Type
- Remove "TestColumn1" column from Comment List Content Type

 

1.jpg
- Open the OOB List new form (of Item Content Type) and Customize the form in Power Apps


2.jpg


Power Apps Configuration

 

Configuring Screens:
- Now in Power Apps, Create Duplicate Screen of default screen. Duplicate screen form will have same data source.
- Rename the Screens to "ContentTypeSPScreen1" and "ContentTypeSPScreen2" respectively.
- Set formula on "ContentTypeSPScreen1" screen OnVisible property
Set(varScreenVisible, "1");

- Set formula on "ContentTypeSPScreen2" screen OnVisible property
Set(varScreenVisible, "2");

 

Configuring Forms:

- Rename the Forms to "ContentTypeSPForm1" and "ContentTypeSPForm2" respectively
- Set both forms default mode as "New"
- In Forms, Add needed fields of respective OOB content type onto the form:
- Add Title, TestColumn1 and CustomContentType in Item Form "ContentTypeSPForm1"
- Add Title, TestColumn2, TestColumn3 and CustomContentType in Comment Form "ContentTypeSPForm2"
- In "ContentTypeSPForm2" form, make “TestColumn2” as mandatory by Setting "TestColumn2" field "Required" property as true.


3.jpg

- In CustomContentType field in "ContentTypeSPForm1" form, Set "Update" value as "ddCT1.Selected.CTValue" and Visible as "false".
- In CustomContentType field in "ContentTypeSPForm2" form, Set "Update" value as "ddCT2.Selected.CTValue" and Visible as "false".

Configuring App OnStart event:
- In App "OnStart" event add this code


Collect( ContentTypeList,

{

CTId: 1,

CTValue: "Item"

},

{

CTId: 2,

CTValue: "Comment"

}

); Set (varScreenVisible, "1"); Navigate(ContentTypeSPScreen1,ScreenTransition.Fade);


Configuring dropdown control in "ContentTypeSPScreen1" screen:

- Add new label lblCT1 and dropdown ddCT1 controls to screen "ContentTypeSPScreen1".
- Assign dropdown data source as "ContentTypeList" and assign Value as CTValue.
- Set "Item" text to "Default" property of "ddCT1" dropdown control
- Set varResetddCT1 to "Reset" property of "ddCT1" dropdown control
- Apply formula on ddCT1 "onChange" event:
If(ddCT1.Selected.CTId = 2, Set(varResetddCT2,true); Navigate(ContentTypeSPScreen2,ScreenTransition.Fade));

Configuring dropdown control in "ContentTypeSPScreen2" screen:

- Add new label lblCT2 and dropdown ddCT2 controls to screen "ContentTypeSPScreen2".
- Assign dropdown data source as "ContentTypeList" and assign Value as CTValue.
- Set "Comment" text to "Default" property of "ddCT2" dropdown control
- Set varResetddCT2 variable to "Reset" property of "ddCT2" dropdown control
- Apply formula on ddCT2 "onChange" event:
If(ddCT2.Selected.CTId = 1, Set(varResetddCT1,true); Navigate(ContentTypeSPScreen1,ScreenTransition.Fade));

Form controls should look like this:

 

4.jpg

Configuring "SharePointIntegration":

- In SharePointIntegration, Update formula in advanced events carefully as mentioned in screen shot below:

 

5.jpg

Publish Power Apps:

- Save Power Apps and Publish to SharePoint

Test in SharePoint List:

- Now in SharePoint List, you can select any Content Type from OOB New Item dropdown. This doesn't matter as we will select actual content type from our new Custom Power Apps Form.


6.jpg

 


- Now try saving "Item" Content Type form

 

7.jpg

- Also try "Comment" Content Type form


8.jpg

- It should show items in list as below
9.jpg

Note: This example is for "New" form. For Edit form, you can duplicate screens plus forms and make its default mode as "Edit" and then you can apply some custom logic based on "CustomContentType" field to edit particular Content Type form in Power Apps. Also here we considered only 2 content types to give you an idea how it can be done in Power Apps, but you may have multiple content types and logic can be replicated to those in a similar way like mentioned in this article.


Happy Learning, Anywhere! 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
ShriramP
Advocate II
Advocate II

Consider above article as a solution to SharePoint Content Type in PowerApps workaround topic!

View solution in original post

32 REPLIES 32
v-jefferni
Community Support
Community Support

Hi @ShriramP ,

 

Thanks a lot for sharing this!

 

Please consider reply your original post and mark it as a solution to help other users find this.

 

Best regards,

Community Support Team _ Jeffer Ni

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

ShriramP
Advocate II
Advocate II

Consider above article as a solution to SharePoint Content Type in PowerApps workaround topic!

Thanks @v-jefferni !

 

I will surely do so!

lmdiorio
Frequent Visitor

I followed all the steps but it doesn't work when custom content type is Document Set.  Anyone have a solution for having a PowerApps form when using Document Set.  The error is below when attempting to save.

lmdiorio_0-1658814080969.png

 

ICPAaron
Frequent Visitor

Where is the crucial step in these directions that tells SharePoint to use the custom Power Apps form? I know how to create a custom form in Power Apps and how to work with content types, but I do not understand how to tell SharePoint to use the custom form. Please advise.

To clarify, I created a custom content type called "Contractor" and selected Document Set as the parent.  I can edit an existing item with my PowerApps form that was created using the out-of-the-box document set form.  However, I cannot create a new one using PowerApps form.  I think it is because it is trying to save the item using the "Document" content type which is part of a document set instead of the custom "Contractor" content type 

@ShriramP  do you have experience with the above use case?

geddb
Helper II
Helper II

Thank you so much @ShriramP for this detailed explanation. Unfortunately, I get an error in the OnStart Property of the App.
- "Navigate is not permitted OnStart. Use the StartScreen property instead."
I cut the Navigate line of code and pasted it in the StartScreen property and got this error message
- "Behaviour function in a non-behaviour property. You can't use this property to change values elsewhere in the app"

geddb_0-1658970594723.png

 


Any assistance will be greatly appreciated.

geddb

geddb
Helper II
Helper II

For anyone experiencing the issue I raised above, @Mostafa supplied an answer that solved my problem. Thank you @Mostafa for the very simple fix 🐵

 

geddb_0-1658971827791.png

 

Thanks @geddb ! And nice to know that you already received help from @Mostafa 🙂

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!      

Tuesday Tip | How to Report Spam in Our Community

It's time for another 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!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros 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! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

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