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 / OnChange Patch into co...
Power Apps
Unanswered

OnChange Patch into collection not firing when new Gallery item selected

(1) ShareShare
ReportReport
Posted on by

I have a gallery with survey topics, and a rich text input box outside the gallery.

The default property of the rich text input is a lookup into collection 'ResponseCollect'.

OnChange has a patch function in an attempt to get the user's input written into the collection when they click onto the next item in the gallery.

The text is written only if the user clicks elsewhere on the page before selecting the next gallery item. If a gallery item is selected the text input is lost.
How can i ensure the OnChange function is triggered when a new gallery option is selected? OnSelect of the Gallery is currently blank

 

 

Default:
LookUp(ResponseCollect, Topic = Gallery.Selected.TopicInput.Text, Commentary)
//ResponseCollect is the collection of all responses, this is later patched to SQL
//Gallery holds the topics of the survey for which the user needs to provide commentary

OnChange:
Set(NewResponse, Defaults(ResponseCollect));
//NewResponse collection is used to patch a single row to ResponseCollect

Set(NewResponse,
 Patch(NewResponse,
 {Topic: Gallery.Selected.TopicInput.Text,
 Commentary: Narrative.HtmlText,
 Customer: Customer.Text, 
 ProjectName: ProjN.Selected.Value, 
 ProjectID: ThisProjectID.Text, 
 SurveyConductedBy: Conducted_By.Text, 
 SurveyDate: Survey_Date.SelectedDate, 
 PersonSurveyed: Person_Surveyed.Text}));

Patch(ResponseCollect,
 Coalesce(LookUp(ResponseCollect, Topic = Gallery.Selected.TopicInput.Text)),
 Defaults(ResponseCollect),
 NewResponse)

 

 


 

PowerAppsOnChange.jpg
Categories:
I have the same question (0)
  • developingteal Profile Picture
    392 on at

    instead of using onChange, build something that concurrently checks if the row has changed - though this should be done in onChange, this is a fool proof way of doing it. 

     

    The expression would be like : if(id changes,  then run current on change)

     

    I would put the expression in something like a timer or whatever way you want it to constantly check.

  • developingteal Profile Picture
    392 on at
    What's the status of this/ what's the current error?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 308

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard