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

patch function to add a new task in a gallery (sharepoint list)

(0) ShareShare
ReportReport
Posted on by 12

hello

i am looking forward to do an app for tasks, that are related to our cars.

 

i have a list KFZ-Liste, in which all my cars are. i the column Titel is the InternalNumber (IKZ) of the cars.

in my TasksList ( tbl_Termine) there is a related Column called IKZ, in which are the InternalNumbers vom KFZ-Liste.

if i add a new Task i have in the MainGallery a car picked, so that the Titel with the IKZ is selected.

the Tasks for the Cars that are created are shown, i can update them with the Patch function.

 

i have a Button to add a new Task for the selected Car with this Code:

 

Patch(
tbl_Termine;
Defaults(tbl_Termine);
{
Titel: "Neuer Termin";
'Termin vereinbart':false;
'abgeholt (Werkstatt)':false;
'zurück (Werkstatt)':false;
'Mängel behoben':false;
IKZ: {
Value: gal_alleKFZ.Selected.Titel;
ID:gal_alleKFZ.Selected.ID
}
}
)

but it does not work.

any ideas?

Screenshot 3.jpg
Screenshot 1.jpg
Screenshot 2.jpg
Categories:
  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    Hi @MeddlBosdler ,

    Two things I can see (I assume you are using SharePoint here) - you have a bracket in the wrong place and you cannot patch the ID to a new record. If you want to update an existing records, leave out the Defaults line - for a new record leave out the ID line.

    New record

    Patch(
     tbl_Termine;
     Defaults(tbl_Termine);
     {
     Titel: "Neuer Termin";
     'Termin vereinbart': false;
     'abgeholt (Werkstatt)': false;
     'zurück (Werkstatt)': false;
     'Mängel behoben': false;
     IKZ: {Value: gal_alleKFZ.Selected.Titel}
     }
    )

    Existing record

    Patch(
     tbl_Termine;
     {
     ID: gal_alleKFZ.Selected.ID';
     Titel: "Neuer Termin";
     'Termin vereinbart': false;
     'abgeholt (Werkstatt)': false;
     'zurück (Werkstatt)': false;
     'Mängel behoben': false;
     IKZ: {Value: gal_alleKFZ.Selected.Titel}
     }
    )

     

    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

  • MeddlBosdler Profile Picture
    12 on at

    Thank you for your fast answer.
    i tried it without the ID befor, but didn't work either.

    it says an other Record Type is assumed and ther has to be a column Id with type Number in it.

  • MeddlBosdler Profile Picture
    12 on at

    could it be that it's because it's a DropDown with Choices?
    has it to be another formula?

    Patch(
    tbl_Termine;
    Defaults(tbl_Termine);
    {
    Titel: "Neuer Termin"}
    )

    so it works. would be fine for me, but i need the IKZ to have the Task at the right Car.
    i only need the IKZ there somehow.

    made a new label with the IKZ and tried it, but doesn't work either

  • MeddlBosdler Profile Picture
    12 on at

    I also tried a new Column in my Sharepoint List with the Name IKZ2, which does not have the choices
    i get a new Record, but i also don't get an Entry there.

  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    @MeddlBosdler ,

    Ca you please provide a screen shot of your field types in List Settings

  • MeddlBosdler Profile Picture
    12 on at

    it's in German

    Screenshot s4.jpg
  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    @MeddlBosdler ,

    I need your List Settings showing the field types (cog at top right)

  • MeddlBosdler Profile Picture
    12 on at
    Screenshot 6.jpg
    Screenshot 5.jpg
  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    @MeddlBosdler ,

    They should look like this

     

    WarrenBelz_0-1699437636747.png

     

  • MeddlBosdler Profile Picture
    12 on at

    i made a picture from my table, there are also left of the column what kind they are.
    here they stand in German

    Screenshot 8.jpg
    Screenshot 7.jpg

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 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard