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 / I need help with updat...
Power Apps
Answered

I need help with update function?

(1) ShareShare
ReportReport
Posted on by 16

Im trying to update a existing record using htis formula but when I try it it say comment udpated but it remved the comment and I cant see the new updated comment.  Im trying to first check that the user who has made comment can only change. The below code is is for submit button of update form. The writebackcomment is the sharepoint list file.

 

If(
    selectedComment.USERNAME = User().FullName,
    Patch(
        Writebackcomments,
        selectedComment,
        {
            COMMENTS: Inputcpmments.Text,
            DATE: Now()
        }
    );
    Notify("Comment updated successfully.", NotificationType.Success);
    Navigate(Screen1, ScreenTransition.None),
    Notify("You are not the author of this comment.", NotificationType.Error)
)
Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @samgamer3000 -

     

    1. Your Patch statement will overwrite the existing field with the new value in Inputcpmments (assuming this is a Text Input Control. Is that not what you were expecting?
    2. When you say it "removed" the comment, does that mean the comment field for that record is blank?
    3. What is the reason for using a Patch function here, given you're using an EditForm control? (the EditForm leverages the SubmitForm function).
    4. What does sharepoint list file mean?
  • Verified answer
    AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @samgamer3000

    you can try adding a Refresh to the later part of the true statement to refresh your list in the app:

    If(
     selectedComment.USERNAME = User().FullName,
     Patch(
     Writebackcomments,
     selectedComment,
     {
     COMMENTS: Inputcpmments.Text,
     DATE: Now()
     }
     );
     Notify("Comment updated successfully.", NotificationType.Success);
     Refresh(Writebackcomments);
     Navigate(Screen1, ScreenTransition.None),
     Notify("You are not the author of this comment.", NotificationType.Error)
    )

     

    What you are doing currently its completely replacing the selected comment with the new text input in the application and this will make changes in the SharePoint lust but this hasn’t yet been refreshed and pullback down to you app.

     

    Hope this helps

    Please click Accept as solution if my post helped you solve your issue. ✔️ This will help others find the solution to this problem. It also closes the item. Remember, you can accept more than one post as a solution.

    If the content was useful in other ways, please consider giving it Thumbs Up. 👍

    Thanks
    Andrew

  • samgamer3000 Profile Picture
    16 on at
    Thank you it solved my problem

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard