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 / Help with the Patch fu...
Power Apps
Unanswered

Help with the Patch function (Sharepoint list form)

(0) ShareShare
ReportReport
Posted on by 818

So this Sharepoint is populating one of the Option columns with an Excel table and I'm trying it to get it to save whatever you pick for the Excel column into the Sharepoint List (I know an option would be a Text column but that's not working for me, want to try if the Option column fixes my troubles).

How would you use the Patch function for this? I've been trying it like that, to no avail:

Patch(SharePointForm1;Defaults(SharePointForm1); {OptionColumn: Dropdown.Selected.Value})

An error shows up: Unvalid argument (Control) a Table one was expected.

The excel is displaying all items, so no issue there. Problem is getting it to save actually to the SHarepoint

Appreciate your help in advance!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @WorkingRicardo ,

    I am assuming you are referring to a Choice column whne you say "option column" If so try this (you also need to patch the list, not the form)

    Patch(
     SharePointListName;
     Defaults(SharePointListName); 
     {
     OptionColumn: 
     {Value: Dropdown.Selected.Value}
     }
    )

     

    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

     

  • WorkingRicardo Profile Picture
    818 on at

    Hey  @WarrenBelz , ty for the reply. OK i changed the formula a bit

    Patch(
     'Lista FINAAAAAAAAAAAL de prueba';
     Defaults('Lista FINAAAAAAAAAAAL de prueba');
     { 
     'Opciones de prubea'::
     {Value: DataCardValue8.Selected.Cliente}
     }
     )

     Now it saves new entries but the button should also close the form, no? How do i get it to do that as well?

    Furthermore, if I go this Patch path, I have to Patch every single column from the list? Because this only gave no errors in a brand new List where no other field was required. Instead, in my main list there are 2 required items (none of them are the ones I'm patching), and even tho I was selecting the option in the form, it still gave the error that that field was required. So I'm guessing EVERYTHING must be patched manually, no?

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

    @WorkingRicardo ,

    To hide the Form, put RequestHide() at the end of your code. You can also do this

    Patch(
     'Lista FINAAAAAAAAAAAL de prueba';
     Defaults('Lista FINAAAAAAAAAAAL de prueba');
     SharePointForm1.Updates
    )

    but I am wondering why you do not simply submit the Form.

     

    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

  • WorkingRicardo Profile Picture
    818 on at

    hey  @WarrenBelz ty!
    Will try this now. But, for the other part of my question is true? I mean I have to patch in that code for all 20 columns xD? I hope not... And its only for this item that is causing trouble?

    The question is, if I use Patch for 1 thing, that forces me to use it for everything else as well?

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

    @WorkingRicardo ,

    If you use FormName.Updates, you do not need to specify the columns. If you Patch fields individually, yes you need to send any columns that are likely to have data in them. You can however submit a form in one instance and Patch in the next (you can do either at any time).

     

    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

  • WorkingRicardo Profile Picture
    818 on at

    hey again  @WarrenBelz  got my code with no errors like this: 

    Patch(
     Incidencias;
     Defaults(Incidencias);
     { 
     Cliente:{Value:DataCardValue14.Selected.Cliente};
     Incidencia:{Value:DataCardValue1.Selected.Value};
     'Departamento encargado':{Value:DataCardValue3.Selected.Value};
     'Registro incidencia':DataCardValue5.SelectedDate;
     'Número Documento':DataCardValue13.Text;
     'Personal encargado':DataCardValue4.SelectedItems;
     'Fecha tentativa de resolución':DataCardValue6.SelectedDate;
     'Fecha resolución':DataCardValue7.SelectedDate;
     Estado:{Value:DataCardValue2.Selected.Value};
     Producto:{Value:DataCardValue12.Selected.Producto}
     }
    )

    But where does the RequestHide() go? The Updates SHarepointForm1 also wouldn't know. I tried many ways for both and still getting errors. 

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

    @WorkingRicardo ,

    At the end

    Patch(
     Incidencias;
     Defaults(Incidencias);
     { 
     Cliente:{Value:DataCardValue14.Selected.Cliente};
     Incidencia:{Value:DataCardValue1.Selected.Value};
     'Departamento encargado':{Value:DataCardValue3.Selected.Value};
     'Registro incidencia':DataCardValue5.SelectedDate;
     'Número Documento':DataCardValue13.Text;
     'Personal encargado':DataCardValue4.SelectedItems;
     'Fecha tentativa de resolución':DataCardValue6.SelectedDate;
     'Fecha resolución':DataCardValue7.SelectedDate;
     Estado:{Value:DataCardValue2.Selected.Value};
     Producto:{Value:DataCardValue12.Selected.Producto}
     }
    );
    RequestHide()

     

    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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard