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 / Update SharePoint colu...
Power Apps
Answered

Update SharePoint column from selected item in gallery

(0) ShareShare
ReportReport
Posted on by 2,567

Hi im trying to update a specific column named "Comments" in a SharePoint list.

 

I have a gallery that displays the items in this list (Gallery1) 

I then have a Input RichText field.

 

I would like to patch/update comments for the select item in gallery1 with whatever i type in the RichText field.

Im not able to get this to work, i tried patch and i tried submit form. 

Categories:
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @JimmyWork 

     

    Can you try to update the configuration as:

    Patch(DataSourceName, LookUp(DataSourceName, ColumnName = Gallery1.Selected.ColumnName), {Comments: PlainText(RichTextEditor2.HtmlText)})

    This will store the data entered in Rich Text control to the selected item in gallery. Here, ColumnName needs to be replaced with the name of the column to uniquely identify the record.

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • JimmyW Profile Picture
    2,567 on at

    @yashag2255 Thank you for answering.

    I tested you solution and it works, i do get a delegation warning.. Only issue i have is that it overwrites all current comments so i just simply want to add more but not replace.

     

    Patch(DataSource, LookUp(DataSource, 'Case Comments' = Gallery1.Selected.'Case Comments'), {'Case Comments': "<b>"&User().FullName&"</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " & RichTextEditor2.HtmlText & Char(13)) & Gallery1.Selected.'Case Comments')})

     

    What im trying to achive is that it will add new comments and keep the old. Also when adding a new comment it should add the html text containg the user fullname and current time and date.

     

     

  • JimmyW Profile Picture
    2,567 on at

    @yashag2255 

     

    This seems to work without delegation warning. But my issue now is that the text is put last i want it on top. So when i write a comment the latest comment should be on top, right now it becomes the last.

     

    Patch(DataSource,
    Gallery1.Selected,
    {'Case Comments':Gallery1.Selected.'Case Comments' & "<b>" &
    Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Now()&"</span> " &
    Char(13) & RichTextEditor2

    }
    );
    Reset(RichTextEditor2)

  • JimmyW Profile Picture
    2,567 on at

    @yashag2255 Added a image to explain what i mean.

    When i patch a new comment i want it to be displayed 1st. Currently it's displayed like this. I Would like the latest comment to be displayed on top.

     

    2019-12-02 15_50_53-Test Design - Saved (Unpublished) - PowerApps.png

     

     

  • Verified answer
    v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @JimmyWork ,

     

    To display items from SharePoint list with latest item on top, you can use below formula in the Items property of the gallery control:

    SortByColumns( DataSourceName, ID ,Descending)

     

    Regards,

    Mona 

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard