Introduction
Filtering gallery on multiple selection is most demanding user-friendly functionality which could be expected by any business. In this post, we'll look at how to design and implement an ID filter on the gallery, which will be navigating from email.
Note. We shall be creating a flow to achieve this.
I have implemented this feature on complex problems. However, I am implementing this on a simple form for demo and learning purposes.
Scenario
In this article, we shall see how to make a PowerApps gallery with an ID filter. ID will be auto-selected in a textbox and will filter the gallery Item.
Objective
Design your form as per your needs. I have my gallery along with one single line of text (Which will be filtered by ID).
Step 1. List: My list looks like below. ID is out of the box column, which is not shown here.
![Box column]()
List with data looks like below.
![List]()
Step 2. Form: My form looks like this, with filter parameters and a gallery that is connected to the data source.
Step 3. Gallery: My gallery will be designed with existing controls but with modifications to how the values are shown. For example, “Trainer Name”. I will rename the control name from Body1 to “Trainer Name”. Below image, we will also see the textbox to filter.
![Tree view]()
Step 4. Filters ID Column: We will insert a textbox from PowerApps control and change the tooltip. We can design as we wish to. Here, I have added a glass icon on the left.
![Filter]()
Step 5. Add Erase icon to reset the control: On Select the erase icon, reset the control so that the gallery can show all items.
![Reset]()
Step 6. Prepare and Setup for ID filter: On the App OnStart property, we need to write a conditional formula. This says if the Parameter of the ID is not blank, then set the varID variable to the ID value, which is sent in the parameter from the flow.
![App]()
Step 7. Create Url, including ID, which will be sent in email through Power Automate.
We would need to form the URL, and that url comes from the app url.
We can fetch the app URL from App> Details. We will be using the formed url in the workflow.
![Workflow]()
This is a fixed url we need to make out of a web link. Two values we need to pick from the web link and merge to a fixed url.
https://apps.powerapps.com/apps/d26be859-2b2a-4500-b4d4-64cd3538000d?tenantId=78271076-c68a-401c-98c8-aea128edbea7
Step 8. Create Power Automate: To make ID searchable, we need to write a power automate. We will see how to create that power automate now. Provide the flow name and select the trigger point as “when an item is created or modified”.
![Cloud flow]()
Step 9. Configure the trigger of the Power Automate: Configure the site url and list on which the workflow should trigger. A popup will open. Enter the details. There is no save button to save the popup. Once the value is entered, the values get automatically saved.
![Power automate]()
Step 10. Create a New action Initialize variable in Power Automate as shown below.
![Parameters]()
Step 11. Add action set variable in Power Automate.
In this action, set the URL, including the dynamic value of the ID. This ID will be fetched through the formula in the app on the OnStart property. The variable value format has to be exact, as shown in the below image. Extra space also makes the difference.
![Routing URL]()
Step 12. Add send email action.
Provide the address, subject line, and body, which should include the variable (this variable should include url).
![Demo Idfilters]()
Step 13. Set default property of search text field.
This variable will hold the ID value if the ID is not blank. This variable is set on the OnStart property of the app.
![Text input]()
Step 14. Build Formula for Gallery Items.
We have done a large chunk of work now for ID. It would be so easy to use in the app now.
In the formula, as per our requirement, we shall code. Here, I am saying show all items if the ID textbox is blank; otherwise, show only items whose ID starts with the value entered in the textbox. I hope this point is clear. The formula has to be written in the Gallery OnSelect property.
![Search]()
Step 15. Email Screenshot: We can see the ID as hyperlinked. When we click on ID, the PowerApps app opens with the ID 1 filter applied.
![Inbox]()
Step 16. Gallery Output
![Output]()
Conclusion
In the above article, we saw how to open a PowerApps app from an email, and it directly fetches that particular ID and populates the relevant gallery.