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 to sharepoint li...
Power Apps
Answered

Patch to sharepoint list record not working

(0) ShareShare
ReportReport
Posted on by 96

Hi,

 

I ma trying to patch the below to my sharepoint list called QHSE App, when i do it does not seems to work or it creates a new record rather than patching to the record  in QHSE Audit App. Can you advise? I have it set up in a gallery and want it to patch to the the one i have checked on the tick box in the gallery

 

ForAll(RenameColumns(Filter(qhseall,ticked),"ID","TEST"),Patch('QHSE Audit App',LookUp('QHSE Audit App',ID = TEST),{'Non Conformance Status':Dropdown4_1.Selected},{'Non Conformance Date':DatePicker3.SelectedDate}));Notify("Your audit has been saved",NotificationType.Success);ClearCollect(qhseall,AddColumns('QHSE Audit App',"ticked",false));Refresh('QHSE Audit App')

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @kORINNERB 

    Your formula is using the ForAll backward...ForAll creates a table to use to submit to your Patch function.

    Also, there is no need to incur the expensive Refresh function in your app.

     

    Please consider changing your Formula to the following:

     

    Patch('QHSE Audit App',
     ForAll(
     Filter(qhseall, ticked) As _item,
     {ID: _item.ID,
     'Non Conformance Status':Dropdown4_1.Selected,
     'Non Conformance Date':DatePicker3.SelectedDate
     }
     )
    );
    Notify("Your audit has been saved",NotificationType.Success);
    ClearCollect(qhseall, AddColumns('QHSE Audit App', "ticked", false))

     

     

    That said, I would drop the collection to get the "ticked" values for your Gallery.  You can get those without a collection.

    Example:

     

    Patch('QHSE Audit App',
     ForAll(
     Filter(yoruGallery.AllItems, yourCheckBox.Value) As _item,
     {ID: _item.ID,
     'Non Conformance Status':Dropdown4_1.Selected,
     'Non Conformance Date':DatePicker3.SelectedDate
     }
     )
    );
    Notify("Your audit has been saved",NotificationType.Success);
    

     

     

    Also, the above ALL assume the Dropdown and the Datepicker are NOT in the actual gallery but outside of it.  If inside, then prepend those control names with _item.

     

    I hope this is helpful for you.

  • kORINNERB Profile Picture
    96 on at

    Hi Randy

     

    Thank you agree with your suggestion so have gone wiht your second formula and tweaking the gallery and check box details it has worked perfectly, thnak you so much for your help

     

    Kind Regards

     

    Korinne

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

    @kORINNERB 

    No problem...happy to help.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard