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 not upd...
Power Apps
Unanswered

Patch function not updating Sharepoint list

(0) ShareShare
ReportReport
Posted on by 6

Hello, I had an app updating my sharepoint with the Patch function then I just added to the sharepoint and cannot get it to update. I have reconnect the data in the formula, unlinked the sharepoint list and reconnected it to no success. I am getting no error in powerapps. Here is the function I have it working with OnSelect. It takes the current item on the page from the sharepoint list 'checkedout' and when a user punches in their pin# I want it to update the status from available to "Checked-Out"

 

Thanks in advance

 

If(IsBlank(PIN_txt.Text),Notify("Please Enter PIN",NotificationType.Error),If(CountRows(Filter(Drivers,PIN=PIN_txt.Text))>0,Set(LoggedInUser,LookUp(Drivers,PIN=PIN_txt.Text).Driver);Collect(Data,{Vehicle:checkedout.Model,Year:checkedout.Year,Make:checkedout.Manufacturer.Value,Date:Now()-(TimeZoneOffset()/60)/24,Driver:LoggedInUser,Status:"Checked-Out"});Navigate(ConfirmationScreen),Notify("Invalid PIN. Please try Again",NotificationType.Error);Patch('Vehicle Management',LookUp('Vehicle Management',ID=checkedout.ID),{Status:"Checked-Out"})))
 
Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @jjboda,

    Is this checkedout within your Patch() function a list name?

    Why you compare ID from 'Vehicle Management' with the ID from checkedout list?

     

    Your LookUp() function could not be excuted because the way you compare ID, try:

    ForAll(checkedout as Tem,Patch('Vehicle Management',LookUp('Vehicle Management',ID=Tem.ID)),{Status:"Checked-Out"}))
  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @jjboda ,

    You have a few things here that need addressing - firstly your Patch is at the bottom and will only work following the error message that the PIN was wrong. Next (as @v-qiaqi-msft points out), you are referring to a table, not a record with checkedout - you have mentioned the selected record here, so I assume it is done from a gallery. Lastly (again pointed out), the ID in SharePoint in 'Vehicle Management' will not be the same ID as that in checkedout and either you have a reference field linking them (or is checkout a collection based on 'Vehicle Management' ???)

    I assume your Data collection is going to be used in the future somewhere else in the app. So here is a start

    If(
     IsBlank(PIN_txt.Text),
     Notify(
     "Please Enter PIN",
     NotificationType.Error
     ),
     With(
     {
     _Driver:
     LookUp(
     Drivers,
     PIN = PIN_txt.Text
     ).Driver,
     _CheckedOut: YourCheckedOutGallery.Selected
     },
     If(
     IsBlank(_Driver),
     Notify(
     "Invalid PIN. Please try Again",
     NotificationType.Error
     ),
     Collect(
     Data,
     {
     Vehicle: _CheckedOut.Model,
     Year: _CheckedOut.Year,
     Make: _CheckedOut.Manufacturer.Value,
     Date: Now() - (TimeZoneOffset()/60)/24,
     Driver: _Driver,
     Status: "Checked-Out"
     }
     );
     Patch(
     'Vehicle Management', 
     { 
     ID: _CheckedOut.YourIDReferenceField,
     Status:"Checked-Out"
     }
     );
     Navigate(ConfirmationScreen)
     )
     )
    )

     

    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

  • jjboda Profile Picture
    6 on at

    I'm marking this as a solution, because the notify function being before the Patch is what was causing the hangup.

     

    Thanks.

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

    @jjboda ,

    So I am assuming that checkedout is a collection based on ‘Vehicle Management’ and the IDs match.

  • jjboda Profile Picture
    6 on at

    'checkedout' is the name of the the item selected from the 'Vehicle Management' Table. It gets selected and set to checkedout in the page before.

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

    @jjboda ,

    You initial post stated It takes the current item on the page from the sharepoint list 'checkedout so you might see why there was some confusion here

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