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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch Function Error h...
Power Apps
Answered

Patch Function Error has some invalid arguments

(0) ShareShare
ReportReport
Posted on by 8
So I make the form on PowerApps to update data to the item list SharePoint.
I want to the submit button wil be updated the data on item list sharepoint without making or adding a new data. The data that i have input is "Mechanic Name" or "Nama Mekanik", "Grade" on my language with choice type for all, and "Branch" or "Cabang on my language. The form on powerapps is shown the column that will be input by mechanic, such as "Mechanic's ID" or "ID Mekanik" with single text type, "Enter Time" or "Tanggal Masuk" with date time type, "Spesialisasi 1", "Spesialisasi 2", and "Spesialisasi 3" with choice type. I input the syntax on submit button like below, but always error with these description fom co-pilot:

Description Error:

The expression is intended to perform multiple actions when a button is clicked. It is trying to patch a record with default values, notify the user with a success message, submit a form, run a flow, reset the form, and navigate to a different screen.

The errors in the expression are:
1. Invalid argument type (Control) - The 'Defaults' function is expecting a data source as an argument, but it is receiving a control instead.
2. The function 'Defaults' has some invalid arguments - The arguments passed to the 'Defaults' function are not valid.
3. The function 'Patch' has some invalid arguments - The arguments passed to the 'Patch' function are not valid.
4. Invalid argument type (Control) - The 'Patch' function is expecting a record as an argument, but it is receiving a control instead.


The Syntax:
Patch
(
    'AddSpesialisasi',
    Defaults('AddSpesialisasi'),
    {
        'ID Mekanik': DCIDMekanik.Text,
        'Nama Mekanik': DCNamaMekanik.Selected.Value,
        'Grade': DCGrade.Selected.Value,
        'Cabang': DCCabang.Selected.Value,
        'Tanggal Masuk': DCTanggalMasuk.SelectedDate,
        'Spesialisasi 1': DCSpesialisasi1.Selected.Value,
        'Spesialisasi 2': DCSpesialisasi2.Selected.Value,
        'Spesialisasi 3': DCSpesialisasi3.Selected.Value
    }
);

Notify("Data telah disimpan.", NotificationType.Success);

SubmitForm(TambahSpesialisasi);

AddSpesialisasiFlow.Run(TambahSpesialisasi.LastSubmit.ID);

ResetForm(TambahSpesialisasi);

Navigate(HomeScreen)

This is what my PowerApps look like:
shirin_0-1715055891174.png

 


This is what my SharePoint Look like:
shirin_1-1715055969184.png

 

Categories:
I have the same question (0)
  • Verified answer
    v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @shirin ,

     

    The error shows you are using control's name as DataSource in Patch function, please check the list name. I notice that there is a space in the list name, but I can't see it in your provided formula. So, please check if the space is forgot. Another possibility is that there is a control also names "Add Spesialisasi", I recommend you change the control name or use another format for list name.

    [@'Add Spesialisasi']

    vmengmlimsft_0-1715059815609.png

     

    By the way, if TambahSpesialisasi Form's DataSource is also "Add Spesialisasi" and mode is new, this will cause two new records are created in "Add Spesialisasi". I recommend you just keep one.

     

     

    Best regards,

    Rimmon

  • Alex256 Profile Picture
    84 on at

    So, the function patch needs the first argument to be the data source which should be the SharePoint list's name, but you are using the name of the gallery so that why you have that error

  • shirin Profile Picture
    8 on at

    Thank you!!

  • shirin Profile Picture
    8 on at

    Thanks!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 538

#2
WarrenBelz Profile Picture

WarrenBelz 420 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard