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 / Update variable after ...
Power Apps
Unanswered

Update variable after patch SharePoint column

(0) ShareShare
ReportReport
Posted on by 2,563

Currently i have an issue.
I have a gallery that i uses a collection i made from a SharePoint list, I use a filter when i create this collection.

 

ClearCollect(RecordsTickets, Filter(SharePointList, RequesterEmail = varUser && Status.Value="Closed"))

 

On the item on the gallery i use  OnSelect = and i set multiple variables for the item and then navigates to screen2

 

Now to the issue i have.
I use Patch on Screen2 where i save a comment to a SharePoint column.
When i type something and click save what i have written should be displayed instantly meaning the variable for the item should be update. Now the only way that i found to do this is by doing a new ClearCollect using the exact same filter from that was used on Screen1 so it matches the item to update. And i have to do this twice and refresh at the same time to make it work. I'm pretty sure I'm doing this all wrong

 

 

If(
 !IsBlank(RichTextEditorComment_1.HtmlText),
 Patch(
 SharePointList, 
 varSelectedTicket, 
 {
 'Case Comments': "<b>" &
Char(13) & Char(13) & User().FullName & "</b>" & "<br> <span style='font-size:12pt'>"& Text( Now(), "[$-en-US]yyyy/mm/dd hh:mm")&"</span> <br> " &
Char(13) & RichTextEditorComment_1.HtmlText & varSelectedTicket.'Case Comments'
 }
 )
);
Reset(RichTextEditorComment_1);
Refresh(SharePointList);
ClearCollect(RecordsTickets, Filter(SharePointList, RequesterEmail = varUser && Status.Value="Closed"))
Set(varSelectedTicket, Gallery1_1.Selected);
Refresh(SharePointList);
Set(varSelectedTicket, Gallery1_1.Selected);

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at

    Hi @JimmyWork .

    Please see //comments below

    If(
     !IsBlank(RichTextEditorComment_1.HtmlText),
     Patch(
     SharePointList, 
     varSelectedTicket, 
     { 
     'Case Comments': "<b>" &
     Char(13) & Char(13) & User().FullName & 
     "</b>" & "<br> <span style='font-size:12pt'>"& 
     Text( Now(), "[$-en-US]yyyy/mm/dd hh:mm")&"</span> <br> " &
     Char(13) & RichTextEditorComment_1.HtmlText & 
     varSelectedTicket.'Case Comments'
     }
     )
    );
    Reset(RichTextEditorComment_1);
    Refresh(SharePointList);
    ClearCollect(
     RecordsTickets, 
     Filter(
     SharePointList, 
     RequesterEmail = varUser && Status.Value="Closed"
     )
    ) //should be ; semi-colon here
    Set(varSelectedTicket, Gallery1_1.Selected);
    Refresh(SharePointList);
    Refresh(SharePointList); //try refreshing twice - may need a timer in here 
    Set(varSelectedTicket, Gallery1_1.Selected);

     

    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.

  • JimmyW Profile Picture
    2,563 on at

    Thank you @WarrenBelz 

    But this does not solve the issue, the issue is my current solution will fail instantly if the filtering shows any different result on my collection. I even had the issue that it will start to show a different item as i refer to 

    Gallery1_1.Selected

    I would like to be able to just update variable with what was last submitted using ThisItem.Selected 

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

    Hi @JimmyWork ,

    To simplify this - you are

    1. Patching a SharePoint list
    2. Refreshing the list in PowerApps to pick up the updated data
    3. Collecting from the list to get all the User's closed tickets.
    4. Setting a Variable (record table) for the currently selected record
    5. Refreshing the list again
    6. Setting the Variable again the refreshed record (gallery selected)

    Are the two bold bit the ones that do not change?

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