Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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)
)
  • samgamer3000 Profile Picture
    16 on at
    Re: I need help with update function?
    Thank you it solved my problem
  • Verified answer
    AndrewR1 Profile Picture
    1,572 Super User 2025 Season 1 on at
    Re: I need help with update function?

    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

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: I need help with update function?

    @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?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard