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 / Using Patch to send da...
Power Apps
Answered

Using Patch to send data back to Sharepoint error message.

(0) ShareShare
ReportReport
Posted on by 4

 I hope that you can help me with something I’m sure is very simple.

 

I am trying to set up a powerapp that reads from a sharepoint list.  My list is called Employees 2.   It is a simple list.  I’m not using a gallery in the app.  Reading directly from the list.

 

What I’m trying to do with my power app is Set up a drop down box,  select a Employee Name from my Sharepoint List and have it fill the other Labels I have set up.    I think I have this working.

 

My code for my drop down “Employee Name”  is  :   Sort(Distinct('Employees 2','Employee Name'),Result)

 

My code for my lable3 on my form is:  LookUp('Employees 2', 'Employee Name'= Dropdown1.Selected.Result).Title   And for label2 is  LookUp('Employees 2', 'Employee Name'= Dropdown1.Selected.Result).Department

 

What I’m wanting is to put in data into the Reviewer Name field called ReviewerInput   and write that back to my sharepoint.   

The code I have for the input field ReviewerInput is : LookUp('Employees 2', 'Employee Name'= Dropdown1.Selected.Result).'Reviewer Name'      To put any names in the field from Sharepoint if they are already there.

 

 

So I set up a button at the bottom to do a patch back to my sharepoint.    The code I have set up for that is :   Patch('Employees 2'.'Reviewer Name',{'Reviewer Name': ReviewerInput.Text})

 

However I’m getting an error message when I try to patch it back to sharepoint and its not writing anything.

 

The error message I’m getting is:    The data source supplied to the function is invalid.  

 

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @dwork62 

    Your Patch formula is going to need the datasource, the record to modify and then the modifications.

     

    So your Patch statement should be this:

    Patch('Employees 2',
     LookUp('Employees 2', 'Employee Name'= Dropdown1.Selected.Result)
     {'Reviewer Name': ReviewerInput.Text}
     )

    Keep in mind, this is only going to update the First record it encounters.  If you have a need to update ALL items in SharePoint for that EmployeeName, then consider this formula:

     

    UpdateIf('Employees 2',
     'Employee Name'= Dropdown1.Selected.Result
     {'Reviewer Name': ReviewerInput.Text}
     )

     

    I hope this is helpful for you.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi@dwork62,

    Based on the issue that you mentioned, do you want to patch names from ReviewerInput to 'Employees 2' if there is no name within that record?

    Since you want to patch the value from ReviewerInput to the Reviewer Name field, you should make sure that you have this Reviewer Name field within your 'Employees 2'.

    What's more, the Patch() formula you provided has something syntax wrong. Here is a standard Patch() formula for reference.

    Patch( DataSource, BaseRecord, ChangeRecord1 [, ChangeRecord2, … ])

    I agree with @RandyHayes mostly, I do some addition with that. And What's more, there is something syntax wrong with his formula which a comma is missing.

    I have a test on my side, please modify your formula as below.

     

    Patch('Employees 2',
     LookUp('Employees 2', 'Employee Name'= Dropdown1.Selected.Result),
     {'Reviewer Name':TextInput1.Text})

     

    Note: Replace the TextInput1 withe your ReviewerInput.

    0713Gif3.gif

    Best Regards,

    Qi

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard