In this Power Apps Tutorial, I will show you how to fix an error, The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’. The function ‘Patch’ has some invalid arguments that come while working with Power Apps Patch function.
I recently had to build a Power Apps canvas app using various Modern controls. There I needed to save the user-provided data into the Power Apps Collection. While I used the Power Apps Patch function on the Submit button, I got the above Patch function error.
The screenshot below represents the Power Apps Patch error that displays: “The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’. The function ‘Patch’ has some invalid arguments“.
We’ll now explore deeper into this issue and offer some solutions that you can follow.
Also, Read: Power Apps Modern Tab List Control [Everything in Detail]
The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’ – Error
- Here, I have a SharePoint List named Product Details. As shown below, this list includes several columns as well as records. Such as:
- Product ID = This is a Title column with a Single line of text data type
- Product Name = Single line of text
- Attributes = Choice
- Quantity = Number
- Price = Currency
- Customer Name = Single line of text
- Location = Single line of text
- Product Image = Image
- Sales Date = Date and time
- Is Order Received = Yes/No
Refer to the screenshot below.
- In Power Apps, I created a Power Apps Collection (colProductInfo) and stored all the above SharePoint list values.
- Next, I have added some of the Power Apps Modern Controls like Text, Text input, Dropdown, Date picker, Checkbox, etc in a Rectangle control.
- Also, there is a Power Apps Modern Button control that helps to save the data in the Power Apps collection. And to save it, I used Power Apps Patch function.
- I have applied the code below on Button’s OnSelect property:
OnSelect = Patch(colProductInfo,Coalesce(varItemData,{Title: "",ProductName: "", Attributes: "", Quantity: "", Price: "", SalesDate: Blank(), CustomerName: "", IsOrderReceived: ""}),{Title: TextInputCanvas1.Value,'Product Name': TextInputCanvas1_1.Value,Price:Value(Text(TextInputCanvas1_3.Value)),Quantity:Value(Text(TextInputCanvas1_2.Value)),'Sales Date':DatePickerCanvas1.Value,'Customer Name':TextInputCanvas1_4.Value,'Is Order Received':CheckboxCanvas1.Checked, Attributes:DropdownCanvas1.Selected.Value})
Where,
- colProductInfo = Collection name that is created before
- varItemData = Variable name
- Title, ProductName, Attributes, Quantity, and so on = SharePoint Column names
- TextInputCanvas1, TextInputCanvas1_1, TextInputCanvas1_2, and so on = Modern Text input Control names
But whenever I wrote the above code, I got a Power Apps Patch error “The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’. The function ‘Patch’ has some invalid arguments“.
In the below section, we will see how we can fix this above issue in Power Apps Patch function.
Check: Power Apps Modern Dropdown Control [Complete Tutorial]
The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’ – Solution
When I came upon this problem, I looked for details on the internet and visited a few websites. But I found a fix and applied it. My issue was soon rectified, and I continued as necessary.
- The above error clearly states that argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’.
- That means Attributes is a SharePoint Choice Column and you need to pass this choice column with a proper format i.e. Attributes: {Value: DropdownCanvas1.Selected.Value}.
- We can not directly specify the SharePoint Choice value like DropdownCanvas1.Selected.Value. This is the only difference.
OnSelect = Patch(
colProductInfo,
Coalesce(
varItemData,
{
Title: "",
ProductName: "",
Attributes: "",
Quantity: "",
Price: "",
SalesDate: Blank(),
CustomerName: "",
IsOrderReceived: ""
}
),
{
Title: TextInputCanvas1.Value,
'Product Name': TextInputCanvas1_1.Value,
Price: Value(Text(TextInputCanvas1_3.Value)),
Quantity: Value(Text(TextInputCanvas1_2.Value)),
'Sales Date': DatePickerCanvas1.Value,
'Customer Name': TextInputCanvas1_4.Value,
'Is Order Received': CheckboxCanvas1.Checked,
Attributes: {Value: DropdownCanvas1.Selected.Value}
}
)
Where,
- Attributes = SharePoint Choice Column Name
- DropdownCanvas1 = Power Apps Modern Dropdown Control Name
- Once you will apply the above code, you will see the specific Patch function error won’t appear. Just Save and Publish the app. Preview the app and Click on the SUBMIT button. Finally, the value will save in the Power Apps Collection.
- Additionally, in most cases, you might get the same error by using the SharePoint Currency Column, SharePoint Number Column, etc. To resolve this Patch error, you can use the code below:
For SharePoint Currency Column - Price: Value(Text(TextInputCanvas1_3.Value))
For SharePoint Number Column - Quantity: Value(Text(TextInputCanvas1_2.Value))
Where,
- Price = SharePoint Currency field name
- Quantity = SharePoint Number field name
- TextInputCanvas1_3, TextInputCanvas1_2 = Power Apps Modern Text input control names
This is how to resolve the Power Apps Patch error: The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’. The function ‘Patch’ has some invalid arguments.
Moreover, you may like some more Power Apps and Dataverse tutorials:
- Create Multiple Tabs in Power Apps Form [Lead Management Apps Example]
- Dataverse Error – Please configure your pop-up blocker to allow this site to create pop-up windows
- The JSON function cannot serialize tables/objects with a nested property
- How to Visualize Model Driven Data in Power BI
- Power Apps Modern Progress Bar [Detailed Guide]
- Power Apps Modern Information Button Control [Complete Guide]
This Power Apps Tutorial explains how to fix an error, The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’. The function ‘Patch’ has some invalid arguments that come while working with Power Apps Patch function.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com