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 to edit...
Power Apps
Unanswered

Patch function to edit record

(0) ShareShare
ReportReport
Posted on by 22

Hi, I am trying to use patch to edit a SharePoint list to 'allocate' a user to a task.

 

I initially have a tasking form where people will submit tasks but then I want a separate screen to be able to allocate the task to a user from within a gallery.

 

I have a text input and combo box containing users display names to search for a user and a text input box to add an email address and have set these up to be visible when a button is pressed, and then a save button appears when an name is selected in the combo box. 

 

For info: the Name field is a person or group field in SharePoint and the Email field is a single line of text field.

 

I am quite a beginner at power apps so just trying to get to grips with the formulas/language. There are no error messages but it is patching the email address to the SharePoint list but not patching the user that is selected? Any idea why this is? 

 

Below is the formula in my save button: 

 

UpdateContext({LetsEdit: false});
Patch(
'Allocations List Power Apps', ThisItem, {Email: DataCardValue67_4.Text}, {'Name ({Name})': DataCardValue47_4.SearchText});
Navigate(
'Task Allocations Screen',
ScreenTransition.CoverRight
)

 

 

 

Thanks in advance!

Categories:
I have the same question (0)
  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @tara123 ,

     

    Can you try this Patch formula:

    Patch(
     'Allocations List Power Apps', 
     ThisItem,
     {
     Email: DataCardValue67_4.Text,
     'Name ({Name})': DataCardValue47_4.SearchText
     }
    )

     

    Hope this helps

  • tara123 Profile Picture
    22 on at

    Hi Ethan, 

     

    Thanks for the reply.

     

    It still seems to be doing the same thing- only patching the email rather than the name as well.

     

    Maybe it's something to do with my combo box- this is the formula in the items property of the combo box for display names: 

     

    Office365Users.SearchUser({searchTerm: TextInput4_4.Text, top:999})

     

    Thanks

     

     

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @tara123 ,

     

    If this 'DataCardValue67_4' is a combobox then formula would be 

    //For All Items
    DataCardValue67_4.SelectedItems
    
    //For single value
    DataCardValue67_4.Selected.Value
    
    //Note: .Value is usually present but if you don't have then add a dot after Selected and see the suggestions that App gives you
    For Example:
    DataCardValue67_4.Selected.Email

     

    I'm not sure of top:999 thing, but do check the above code and let me know if this works

  • tara123 Profile Picture
    22 on at

    tara123_0-1685703957879.png

    So this is how it's set up- the search text for names is TextInput4_4 and the combo box below it to select the user is DataCardValue47_4. The other text input box for the email is DataCardValue67_4. 

     

    Which part were you meaning to put selecteditems or selected.value? The Save button where my patch function is or the combo box items property with the 'Office365Users.SearchUser({searchTerm: TextInput4_4.Text, top:999})' to search users?

     

    Sorry if it's confusing haha! Thanks

     

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @tara123 ,

     

    In your save button where you are trying to get values of combo-box 

    To get values, you need to use SelectedItems or Selected.Value

     

    Try and let me know if you get any error

  • tara123 Profile Picture
    22 on at

    Hi Ethan, 

     

    Ah okay, I changed it to SelectedItems and it's given me an error 'The type of this argument '{Name}' does not match the expected type 'text'. Found type 'Table''.

     

    For Selected.Value it's giving the error 'The type of this argument '{Name}' does not match the expected type 'text'. Found type 'Error'' and 'Name isn't Valid. Value isn't recognized'.  

     

     

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @tara123 ,

     

    Is your column name correct? 

    Have you got this exact name suggested by the App itself for that context? 

  • tara123 Profile Picture
    22 on at

    I just changed the name of the column to 'Name234' to check it was the right one and now I'm getting errors but it's not telling me what the error is. I changed the TextInput4_4 to say ThisItem.Name234 as that just said Name before but it's got an error line under. And changed it in my patch to Name234. Both don't seem to like this one... 

     

    tara123_0-1685706097374.png

     

     

    tara123_1-1685706175282.png

     

     

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @tara123 ,

     

    Column names doesn't come from the App, its the column name from datasource. 

    So, ensure the name is the same that App suggests you 

     

  • tara123 Profile Picture
    22 on at

    Hi, 

     

    Yeah, I changed it in my data source so the column in the sharepoint is 

     

    tara123_1-1685708817309.png

    And I changed the patch one to : 

    tara123_2-1685708885921.png

    But it's still not happy 😞 

     

    So frustrating! 

     

     

     

     

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