Power Apps Patch Error: The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’

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“.

does not match the expected type record in power apps
does not match the expected type record in power apps

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.

the type of this argument does not match the expected type powerapps
the type of this argument does not match the expected type powerapps
  • 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,

  1. colProductInfo = Collection name that is created before
  2. varItemData = Variable name
  3. Title, ProductName, Attributes, Quantity, and so on = SharePoint Column names
  4. 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“.

does not match the expected type record in power apps
power apps does not match the expected type record found type text

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,

  1. Attributes = SharePoint Choice Column Name
  2. DropdownCanvas1 = Power Apps Modern Dropdown Control Name
powerapps does not match the expected type record found type text
powerapps does not match the expected type record found type text
  • 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,

  1. Price = SharePoint Currency field name
  2. Quantity = SharePoint Number field name
  3. 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:

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.

>