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 / Patch Function Error
Power Apps
Unanswered

Patch Function Error

(0) ShareShare
ReportReport
Posted on by 2

I am working on teams power app.

 

I am trying to use the below code but getting error Invalid argument.

Please guide the correction in this code :

Patch(
TablePartsReturnA,
If(gblReturnNewRecord, Defaults(TablePartsReturnA), SearchResultGallery_3.Selected),
{
FormNo: TextBox2.Value,
FormDate: TextBox2_1.Value,
Product: TextBox2_2.Value,
FCNo: TextBox2_3.Value,
FCissueDate: TextBox2_4.Value,
FCTargetDate: TextBox2_5.Value
}
);
Set(gblReturnNewRecord,false);

 

MIA27_0-1711821976907.png

 

 

 

Categories:
I have the same question (0)
  • RogierE Profile Picture
    875 Moderator on at

    My tip would be to hover your mouse over all of the rows within the Patch formula to find out which argument is invalid specifically. 

    Please LIKE the reply and ACCEPT it as the solution if the answer is what you were looking for.
    (to help me grow in community rank and help others find the solution)

  • MIA27 Profile Picture
    2 on at

    I found the below error on the hover over on mouse 

     

    MIA27_0-1711822407747.png

     

  • MIA27 Profile Picture
    2 on at

    MIA27_1-1711822503944.png

     

    Also note, as I thought that it may be expecting .Selected for date field, But it is not allowing me to do that. It has only option to select .value , And there is no other field to select for date entry

    As I have a normal text box , where I will type the date and patch it.

     

    Please guide

     

     

  • RogierE Profile Picture
    875 Moderator on at

    You can use the DateTimeValue(Textstring) formula to translate your text to a date time value. 

    Please LIKE the reply and ACCEPT it as the solution if the answer is what you were looking for.
    (to help me grow in community rank and help others find the solution)

  • Himanshu_90677 Profile Picture
    416 on at

    Hey @MIA27 

    Your TextBox2_4.Value is type of string, you have to pass date value 

    Convert text to date type

    Do let us know if you encounter any issue

  • trstrean Profile Picture
    185 on at

    It's hard to determine what could be your issue based on the info you provided.  Is everything a text field?  You can narrow down where the issue is by removing fields to find which one is causing the issue.  My guess would be your date field could be the problem, but if you are updating a text field than what you are doing would work.  If the data source has choice fields, your approach wouldn't work for that field type.  Once you figure out which field is the problem, identify a data type mismatch and adjust the syntax to provide the right info to the data source.  

  • MIA27 Profile Picture
    2 on at

    Dear Mr. Rogier,

    Noted and change all the Input field on the screen according to the Table. (I mean if table column is Date Field Type, the I selected Date picker for data entry.

     

    so revised the code as below , but still getting the error of invalid arguments:

    Patch(
    TablePartsReturnA,
    If(gblReturnNewRecord, Defaults(TablePartsReturnA), SearchResultGallery_3.Selected),
    {
    FormNo: TextBox2.Value,
    FormDate: DatePicker1.Value,
    Product: ComboBox1.Selected,
    FCNo: TextBox2_3.Value,
    FCissueDate: DatePicker1_1.Value,
    FCTargetDate: DatePicker1_2.Value,
    }
    );
    Set(gblReturnNewRecord,false);
     
     
    MIA27_0-1711879178173.png

     

    Kindly review my code, now what the mistake, as I fixed with the data type and cross checked all.

     

    Please guide

     

  • MIA27 Profile Picture
    2 on at

    Dear Mr. Himanshu,

    please find reply posted having still the error in details, I change the fields according to the table column data type,

    Still the error.

     

    Please review and guide

     

     

  • MIA27 Profile Picture
    2 on at

    Dear,

    As guided by all of your, I have changed the controls and had matched with the data type of the table.

    Please review my last post with error and full code and guide me for the correction

    Regards

     

  • RogierE Profile Picture
    875 Moderator on at

    Please repeat the same procedure until you run out of errors:

    - hover over all of the rows in your formula

    - wait until it changes the feedback to a specific error

    - correct that error

    >repeat 🙂 

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard