Skip to main content

Notifications

Community site session details

Community site session details

Session Id : uiwIAuvfq41QmToTFx3x6v
Power Apps - Building Power Apps
Answered

SharePoint Content Types in PowerApps Form - A Workaround!

Like (4) ShareShare
ReportReport
Posted on 2 Feb 2021 07:11:09 by 76

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! 🙂

  • Rashmi_17 Profile Picture
    47 on 14 Feb 2024 at 14:12:08
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    Hi @ShriramP ,
    I have created a powerapps form using the above steps. The new mode is working fine but edit mode is displaying wrong form when i try to edit and also i am not able to save the information after editing the form. Any work around on this would be appreciated. 

  • DawidNohl Profile Picture
    2 on 07 Nov 2023 at 05:45:09
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    Hello @ShriramP  and @Anonymous . Has there been an update to this? 
    I have multiple ContentTypes and created a specific screen for each one of them. Now, for example, I want to direct the user directly to the the screen of ContentType2 and put the form in view mode, when he clicks on an item with ContentType = "2" in SharePoint. 
    I am also using the system column "Content type" for this, since I am working with migrated data and the old data wouldnt have a "CustomContentType"-Column for example.

    Could you please help me here? I have tried to solve this problem through different means (also "patch" function didnt work out), but I cant seem to make headway.

     

    Regards, Dawid

  • Rashmi_17 Profile Picture
    47 on 12 Sep 2023 at 14:29:28
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    Hi @ShriramP 

    I am trying to replace the onstart with navigate function with startscreen to improve load time of the powerapps form. So can you help me this code on how we can write startscreen code.

     

    This is the OnStart code i have in my form.

     

    Collect(ContentTypeList,
    {
       CTId:1,
       CTValue:"form1"
    },
    {
       CTId:2,
       CTValue:"form2"
    },
    {
       CTId:3,
       CTValue:"form3"
    }
    );Set(varScreenVisible,"1") &&
    Set(varTabSelected,"manager");
    Set(varDdlCTDefault,"form1");
    Navigate(ContentTypeScreen1,ScreenTransition.Fade);

  • ShriramP Profile Picture
    76 on 03 May 2023 at 04:13:28
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    @Anonymous Hi, can you tell me the issue you are facing?

  • Community Power Platform Member Profile Picture
    on 06 Mar 2023 at 18:38:56
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    Hi @Shriram , I am facing Issue in Edit form & View form apart from it is working fine.

    Below is the code for edit form.

    if(
    SharePointIntegration.Selected.'Content type'.Name = "Item",
    EditForm(SharePointForm1) && Navigate(ContentTypeSPScreen1),
    SharePointIntegration.Selected.'Content type'.Name = "Comment",
    EditForm(SharePointForm2) && Navigate(ContentTypeSPScreen2)
    );

     

    Can you please help me as I have tried all scenarios & unable to fix it. Thanks in advance!

  • ShriramP Profile Picture
    76 on 24 Jan 2023 at 09:52:52
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    @Rashmi_17 Good to know! đꙂ

  • Rashmi_17 Profile Picture
    47 on 24 Jan 2023 at 08:06:45
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    Hi @ShriramP 

    Thank you for the solution. It's working good now.

    Keep posting amazing content. 

  • ShriramP Profile Picture
    76 on 24 Jan 2023 at 04:34:24
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    @Rashmi_17 Hi, Thanks for notifying issue regarding dropdown. I was able to fix it. 

     

    Here are updates you will need to do. There is new variable introduced varDdlCTDefault

     

    Step 1) Update App.OnStart event code:

    Collect(
    ContentTypeList,
    {
    CTId: 1,
    CTValue: "Item"
    },
    {
    CTId: 2,
    CTValue: "Comment"
    }
    ); Set (varScreenVisible, "1"); Set(varDdlCTDefault, "Item"); Navigate(ContentTypeSPScreen1,ScreenTransition.Fade);

     

    Step 2) Configuring dropdown control in "ContentTypeSPScreen1" screen:
    - Set varDdlCTDefault variable to "Default" property of "ddCT1" dropdown control
    - Update formula on ddCT1 "onChange" event:
    If(ddCT1.Selected.CTId = 2, Set(varResetddCT2,true); Set(varDdlCTDefault, "Comment"); Navigate(ContentTypeSPScreen2,ScreenTransition.Fade));

     

    Step 3) Configuring dropdown control in "ContentTypeSPScreen2" screen:
    - Set varDdlCTDefault variable to "Default" property of "ddCT2" dropdown control
    - Update formula on ddCT2 "onChange" event:
    If(ddCT2.Selected.CTId = 1, Set(varResetddCT1,true); Set(varDdlCTDefault, "Item"); Navigate(ContentTypeSPScreen1,ScreenTransition.Fade));

     

    After these updates, save and publish changes to SharePoint from Power Apps.

    Open the SharePoint list and refresh (CTRL+F5) few times list view (allitems.aspx) page and new changes should start working.

     

    Note: App.OnStart event triggers only once when you open any first list item form. For subsequent form openings of another items, App.OnStart does not trigger. So, the variable (varDdlCTDefault)  state remains from previous item's form selection. If you want, you may reset varDdlCTDefault variable if needed on some SharePoint integration events or Screen events.

     

     

  • Rashmi_17 Profile Picture
    47 on 23 Jan 2023 at 10:11:26
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    Hi @Shriram, I have tried recreating the form for 2 content types, everything is good but the drop down names doesn't match after rigorous selection in dropdown. Any solution for this?

  • Rashmi_17 Profile Picture
    47 on 20 Jan 2023 at 11:46:38
    Re: SharePoint Content Types in PowerApps Form - A Workaround!

    @ShriramP Yes, will try that. Thank you for your help!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 27

#2
mmbr1606 Profile Picture

mmbr1606 14 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 13 Super User 2025 Season 1

Overall leaderboard
Loading started