Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper I

Make a filter to refreshed only on Select


I have Gallery which reads the data from Sharepoint list.

The Gallery has a filter allowing to filter by project number. The user select a CTR, example “135800-E02”.



Then with Edit button of Form, updates the record as below and then clicks “Submit”



By clicking the submit button, below actions happens:



Patch(CTRList,GLCTR_2.Selected,{Status:{Value:"Submittal Requested"}});



Office365Outlook.SendEmailV2(LookUp(WorkRequest,ProjectNumber=CBProjectList.Selected.Result).WoodFocalPoint.Email & ","& GLCTR_2.Selected.CTRSubmissionRequester.Email & ", " & ContractManager & "," & ProjectControlsManager & "," & GLWorkRequest.Selected.FocalPoint.Email& "," & CostControl1 ,GLCTR_2.Selected.CTRNumber &" CTR Submission Request Notification - Attention: 'Estimating' " ,

"<p><b>The below CTR is ready for 'Estimating' for final review and cover sheet preparation" &


 "</p><b><i><u>CTR Detail: " &


"<table width=600><tr><td><b>CTR Number:</b></td><td>" & GLCTR_2.Selected.CTRNumber & "</td></tr>" &

"<tr><td><b>CTR CTR Title:</b></td><td>" & GLCTR_2.Selected.CTRTitle & "</td></tr>" );

But, as you see in the below screenshot, the Filter on gallery get refreshed to “135800-01” and email get submitted for “135800-1”.

If I remove the filter on Gallery, then works perfect. How can I stop refreshing filter on Gallery unless user changes the project from the list.



 The Items for gallery formula is as below:





Super User
Super User

I assume the Item property of Form1 is GalleryName.Selected and that is why when the gallery is refreshed the form changes to a different item. If this is the case you can create a variable that holds the record and will only change when you click on the item in the gallery.



Gallery > OnSelect >Set(varRecord, GalleryName.Selected)

Form > Item > varRecord


* If you are using GalleryName.Selected.* any place else you would just change it to varRecord.*

If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Super User
Super User


One observation on your formula:

Except in rare instances, avoid chaining commands with OnSubmit(). Instead, move them to the OnSuccess property of the form being submitted. This will prevent them from being submitted if the submission fails. 
In your case the form will become uneditable if the submission fails. If I were a user, that would be frustrating.

When I create the variable, the email get sent for the right record as expected, even it still jumps to the first record after "submit". So, that part is working. The new issue is that, the email notification has items which get updated by submit form like "CTRCommentPE1". This field before submitting the form is blank in sharepoint list. once form submitted, it gets updated based on the data has been entered in the form in Edit mode. But, email get sent with 'blank data" for this field.
I just find a way that the Variable data get refreshed based on edited form before submitting the form. I have updated the Submit button code as below and everything are referred to "varSelectedCTR"

Set(VarShowSpinner, true);


Patch(CTRList,varSelectedCTR,{Status:{Value:"Submittal Requested"}});

Office365Outlook.SendEmailV2(LookUp(WorkRequest,ProjectNumber=CBProjectList.Selected.Result).WoodFocalPoint.Email & ","& varSelectedCTR.CTRSubmissionRequester.Email & ", " & ContractManager & "," & ProjectControlsManager & "," & GLWorkRequest.Selected.WoodFocalPoint.Email& "," & CostControl1 ,varSelectedCTR.CTRNumber &" CTR Submission Request Notification - Attention: 'Estimating' " ,
"<p><b>The below CTR is ready for 'Estimating' for checking and cover sheet preparation" &
"</p><b><i><u>CTR Detail: " &

"<table width=600><tr><td><b>CTR Number:</b></td><td>" & varSelectedCTR.CTRNumber & "</td></tr>" &
"<tr><td><b>CTR CTR Title:</b></td><td>" & varSelectedCTR.CTRTitle & "</td></tr>" &
"<tr><td><b>CTR Revision:</b></td><td>" & varSelectedCTR.CTRRevision.Value & "</td></tr>" &
"<tr><td><b>CTR CTR Phase:</b></td><td>" & varSelectedCTR.CTRPhase.Value & "</td></tr>" &
"<tr><td><b>CTR Submission Requester Comment:</b></td><td>" & varSelectedCTR.CTRComment1PE & "</td></tr>" &
"<tr><td><b>CTR Imperium Link:</b></td><td>" & varSelectedCTR.ImperiumURL & "</td></tr></Table><br></br>
<p>Select link <a href=' & '>to open the application </a> to update.</p>");

Set(VarShowSpinner, false);

Depending on which button get pressed, the commands are different. So, I am not sure how I can link each button to "Success" on one form. For example, if I pressed button 1 > Staus  will be Patched "Pending", if I pressed button 2 > Status  will be Patched "Approved". Maybe an If statement ?

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,205)