Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Creating item with specific content type from PowerApp

(1) ShareShare
ReportReport
Posted on by

Hello,

 

May you please inform me how I can create item with specific content type in the SP list that allows more than one content type?

I want to create the item from PowerApp.

With "patch" function the system is always selecting the first content type. Could I use the content type ID or something else?

 

I will be grateful if you may help me with this case.

 

Thanks. 🙂

 

Regards

Categories:
  • Suggested answer
    FigureOfSheets Profile Picture
    on at
    Creating item with specific content type from PowerApp
    I have found a way to achieve this with the Modern form controls (I suspect it would be easier with the old form controls)

    If you have allowed the management of content types in your site, you will have the ability to add the 'Content Type' column to your list.

    Over in PowerApps, you can add this column to your form. You can see it here at the 6th row down:

     
    PowerApps will add it as a Choice type. The problem is that the content types appear as numbers (not the Content Type name)

    I think these numbers are some kind of index since the ID looks quite different and these numbers seem to increase each time you load the page.
     
     
    I was able to successfully select the content type by choosing from these three choices in the list.
     
    I did manage to find a way to return the Content Type's name using 'Content type'.Name, but when I submitted the form my content type selection was ignored so I went back to presenting the content types as numbers.
     
    However:
     
    1. The numbers change each time I load the page
    2. I do not want my users to select the content type when completing the form
     
     
    My solution was to set the defaultselecteditem to the specific content type that I wanted for that list. In my case, it was always the third item in the list (even though the numbers were changing). I used this formula to retrieve the third choice:
     
    Last(FirstN(Choices([@'MY LIST'].'Content type'), 3))
     
    I then switched off the visibility for that combo box.
     
  • Community Power Platform Member Profile Picture
    on at
    Re: Creating item with specific content type from PowerApp

    Hi  @v-qiaqi-msft ,

     

    Big Thank you. 🙂

     

    Have a nice day!

     

    Kind Regards

     

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Creating item with specific content type from PowerApp

    Hi@boyangerginchev

    My mistake not explaining clearly this to you.

    PowerApps doesn't support content types, which means you could not add new items to the existing specific content types.

    Workaround so far is to achieve this with tabs in PowerApps, which is the method mentioned below:

    https://www.youtube.com/watch?v=NdiQ802dG3E&feature=youtu.be%C2%A0

    Here is a solution for how you can create tabbed form:

    https://wonderlaura.com/2018/01/03/powerapps-tabbed-sharepoint-form/

    Best Regards,

    Qi

  • Community Power Platform Member Profile Picture
    on at
    Re: Creating item with specific content type from PowerApp

    Hi @v-qiaqi-msft ,

     

    I do not want to create a new content type, but new items in the SP list with specific content types from already existing site content types which are added to the SP list where I want to create a new item.

     

    Kind Regards

  • v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Creating item with specific content type from PowerApp

    Hi@boyangerginchev,

    Based on the issue that you mentioned, do you want to create content types within PowerApps?

    If so, I'm afraid there is no way to achieve this within PowerApps, even though SharePoint Content types will give you out of the box SharePoint forms tailored tot he fields in each content type.

    Obviously, you could not use Patch() function to create content types.

    Here is a similar idea you can vote for:

    https://powerusers.microsoft.com/t5/Power-Apps-Ideas/SharePoint-Content-Types-PowerApps-integration/idi-p/91791

    Besides, you can check the following articles for reference:

    https://www.youtube.com/watch?v=NdiQ802dG3E&feature=youtu.be%C2%A0

    Best Regards,

    Qi

  • Community Power Platform Member Profile Picture
    on at
    Re: Creating item with specific content type from PowerApp

    Hi @v-qiaqi-msft ,

     

    First of all, sorry for the late feedback, but was off work for a few days Holiday. 🙂

     

    Thank you, for the example, it is really very useful. 

     

    My scenario - I just wanted to know if I could create an SP list item with 'Patch' function from the canvas app with a specific content type(list, of course, should be set to allow content type management). The function will be executed when button is pressed.

     

    I believe it should be something like this:

     

    Patch('ListName', Defaults('ListName'), {'{ContentType}':NameOfContentType or ID of ContantType, Title: "NewTitle"})

     

    But it not working...Maybe if I try to store the content type data in one global variable it will help.

     

    May you please help me with that issue?

     

    Thank you once again.

     

    KInd Regards

     

  • v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Creating item with specific content type from PowerApp

    Hi@boyangerginchev,

    Could you please share more about your scenario?

    Do you want to patch items from PowerApps to your SP list?

    I assume that you want to patch multiple fields to your SP list, for better understand, you can share your Patch() function with me through a screenshot.

    Based on the issue that you mentioned, I have made a test on my side, please take a try as below:

    In order to keep the same data structure, I choose to create an app via the SP list which leads you to have three screens: BrowseScreen, DetailScreen, and EditScreen.

    In this scenario, you can use SubmitForm() to successfully save what you want to the specific field.

    0812Gif2.gif

    Further, if surely you use Patch() to save data to the SP list, set the OnSelect property of the button as below:

     

    Patch(
     SPlist,
     Defaults(SPlist),
     {
     Item: Dropdown1.Selected.Result,
     Title: DataCardValue4.Text
     }
    )

     

    Note: Dropdown1 is the control where you can assign a new value to the specific field, so is the DataCardValue4. You can assign a new value to any given field, just pay attention to the field type of the SP list, and make sure the data type is the same on both sides of the operator.

    If you want to edit the existing record, you can try the following workaround:

     

    Patch(
     SPlist,
     LookUp(
     SPlist,
     ID = xxx //You can specify a record you want.
     ),
     {Item: Dropdown1.Selected.Result}
    )

     

    Best Regards,

    Qi

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard