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 Comments and Che...
Power Apps
Unanswered

Patch Comments and Checkbox to SharePoint List

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

 

I have a submit button that i'd like the OnSelect to patch whatever comments have been put into a textbox called 'Stage1Approval-Comments'

 

I also have an Agree and Disagree checkbox on the same screen, if one of those are checked, then the patch should enter either "1st Stage Approved" if agree is checked and if disagree is checked then it should display "1st Stage Rejected" in a SharePoint List column named Stage1ApprovalStatus and also the same text in the sharepoint list column named ChangeStatus

 

Please help!

 

Thanks in advance

Dave

Categories:
I have the same question (0)
  • hthpowerapper Profile Picture
    364 Super User 2024 Season 1 on at
    Patch(
     YourSharePointList, // replace with your SharePoint list name
     Defaults(YourSharePointList), // create a new record, replace with your SharePoint list name
     {
     Title: "Some title", // replace with any mandatory field in your SharePoint list
     Stage1ApprovalStatus: If(
     CheckboxAgree.Value, 
     "1st Stage Approved", 
     CheckboxDisagree.Value, 
     "1st Stage Rejected"
     ),
     ChangeStatus: If(
     CheckboxAgree.Value, 
     "1st Stage Approved", 
     CheckboxDisagree.Value, 
     "1st Stage Rejected"
     ),
     Stage1ApprovalComments: 'Stage1Approval-Comments'.Text // replace 'Stage1Approval-Comments' with your TextBox's name
     }
    )

    this code assumes that the checkboxes are mutually exclusive - that is, if the "Agree" checkbox is checked, the "Disagree" checkbox is not, and vice versa. If there's a possibility that both could be unchecked, you might want to add some validation to handle this case.

  • Dave-ITMan Profile Picture
    on at

    Hi @hthpowerapper ,

     

    Thanks for the response, where you've put "create a new record", apologies, I should have mentioned that previous to this screen, the user has selected the SharePoint List record from a Gallery named Gallery2 so can you advise how this needs to be adjusted to update the record based on Gallery2.Selected please?

     

    Regards

    Dave

  • hthpowerapper Profile Picture
    364 Super User 2024 Season 1 on at

    If you want to update an existing record in SharePoint, you need to use the Patch function in a slightly different way. Instead of using Defaults(YourSharePointList) (which is used to create a new record), you need to specify the record you want to update. In your case, it's Gallery2.Selected. Here's how you can modify your Patch function:

     

    Patch(
     YourSharePointList, // replace with your SharePoint list name
     Gallery2.Selected, // update the record selected in Gallery2
     {
     Title: "Some title", // replace with any mandatory field in your SharePoint list
     Stage1ApprovalStatus: If(
     CheckboxAgree.Value, 
     "1st Stage Approved", 
     CheckboxDisagree.Value, 
     "1st Stage Rejected"
     ),
     ChangeStatus: If(
     CheckboxAgree.Value, 
     "1st Stage Approved", 
     CheckboxDisagree.Value, 
     "1st Stage Rejected"
     ),
     Stage1ApprovalComments: 'Stage1Approval-Comments'.Text // replace 'Stage1Approval-Comments' with your TextBox's name
     }
    )

     

    I'm not exactly sure how you have your app set up but if this doesn't work for specifiying which record you could set a global variable in your onselect for you gallery....

    Maybe something like

    
    Patch(
     YourSharePointList, // replace with your SharePoint list name
     LookUp(MySharepointList, MyColumn = MyVariable)
     {
     Title: "Some title", // replace with any mandatory field in your SharePoint list
     Stage1ApprovalStatus: If(
     CheckboxAgree.Value, 
     "1st Stage Approved", 
     CheckboxDisagree.Value, 
     "1st Stage Rejected"
     ),
     ChangeStatus: If(
     CheckboxAgree.Value, 
     "1st Stage Approved", 
     CheckboxDisagree.Value, 
     "1st Stage Rejected"
     ),
     Stage1ApprovalComments: 'Stage1Approval-Comments'.Text // replace 'Stage1Approval-Comments' with your TextBox's name
     }
    )

     

    If this answers your question, please mark one of my replies as Accepted Solution

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 342 Most Valuable Professional

#2
11manish Profile Picture

11manish 234

#3
Valantis Profile Picture

Valantis 187

Last 30 days Overall leaderboard