web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to patch using "te...
Power Apps
Answered

How to patch using "text" type and "record type"

(1) ShareShare
ReportReport
Posted on by 58

Hello, I wanna use patch with 'text' type & 'record' type simultaneously in the button. I try to use this formula :

Patch(
'Monitoring RN',
Gallery1_5.Selected,
{
'Area Responsible': If(ComboBox4.Selected.Title = Blank(), Label8.Text, ComboBox4.Selected.Title)
})

but there is an error that is:
The type of this argument 'AreaResponsible' does not match the expected type 'Record'. Found type 'Text'.

 

How to fix my formula? Please help. Thank you

Categories:
I have the same question (0)
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @cacaw99 

    The error means that the 'Area Responsible' field in your 'Monitoring RN' data source is expecting a Record type, but you're trying to patch a Text type to it.

    When the data type doesn't match, Patch function can't successfully execute.

     

    If 'Area Responsible' is a complex field like a Lookup or a Choice field, you want to make sure that you're patching a record that matches the expected structure, not just a simple text.

     

    In case 'Area Responsible' is a Lookup field for example, your Patch formula should look something like this:

    Patch(
     'Monitoring RN',
     Gallery1_5.Selected,
     {
     'Area Responsible': If(
     IsBlank(ComboBox4.Selected.Title), 
     {Value: Label8.Text}, 
     {Value: ComboBox4.Selected.Title}
     )
     }
    )
    

    In this formula, {Value: Label8.Text} and {Value: ComboBox4.Selected.Title} are Records that match the structure expected by the 'Area Responsible' field.

     

    'Value' is a common subfield name for complex SharePoint fields, but you should replace 'Value' with the actual subfield name if it's different.

     

    Remember to replace the placeholder values with the actual values relevant to your app.

    See if it helps @cacaw99 

  • WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    HI @cacaw99 

    Assuming 'Area Responsible' is a Choice field and you are using SharePoint, this should be what you need

    Patch(
     'Monitoring RN', 
     {ID: Gallery1_5.Selected.ID},
     {
     'Area Responsible': 
     {
     Value: 
     Coalesce(
     ComboBox4.Selected.Title,
     Label8.Text
     )
     }
     }
    )

    If however it is a lookup column, this will get more complex.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • cacaw99 Profile Picture
    58 on at

    Hi @WarrenBelz @poweractivate 

    Thank you for your help, I already use the two of your formula but it still error like this

    cacaw99_0-1691289193141.png

    'Area Responsible' column that I use in my Sharepoint List is a 'lookup' type. So, how to fix it? Thank you

  • Verified answer
    WarrenBelz Profile Picture
    153,051 Most Valuable Professional on at

    @cacaw99 ,

    I suspected that might be the case, but went for the easy one (choice) in case it was one of those. My question now is why are you using a lookup column (which is designed to be restricted to the choices available), then allowing the user to add a typed-in value which is not part of the data set available. You have also changed the Items of the Combo Box (or the output would be ComboBox4.Selected.Value), so why are you bothering even using a lookup column when you are not referencing the choices available. I do not use (for many good reasons) Lookup columns at all - before we go any further, please consider whether a Text column would do the job and this will become far easier.

  • cacaw99 Profile Picture
    58 on at

    I already change my data type in Sharepoint list and it works, thank you Warren

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard