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
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
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
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:
Besides, you can check the following articles for reference:
https://www.youtube.com/watch?v=NdiQ802dG3E&feature=youtu.be%C2%A0
Best Regards,
Qi
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
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.
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
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional