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 Pages / Power pages Filter lis...
Power Pages
Answered

Power pages Filter list on selected field in dropdown

(0) ShareShare
ReportReport
Posted on by 6

Hi,

 

We have a user which is linked to a account, but this account is the parent Account for multiple other accounts. 

When the user logs in, he needs to select which 'subaccount' he wants to use as filter for different lists. 

 

For the subaccount selection, we have build a dropdown list with the following code:


{% fetchxml accounts %}
<fetch mapping='logical'>
<entity name='account'>
<attribute name='accountid'/>
<attribute name='name'/>
</entity>
</fetch>
{% endfetchxml %}

<form id="myForm">
<select id='subAccountOptions' name='selectedOption'>
{% for result in accounts.results.entities %}
<option value="{{result.name}}">{{result.name}} </option>
{% endfor %}
</select>
</form>
<div>
<span id="selectedValue"></span>
</div>

<script>
subAccountOptions.addEventListener("change", function() {
var selectedOption = document.getElementById("subAccountOptions").value;
document.getElementById("selectedValue").textContent = "Selected Value: " + selectedOption;
localStorage.setItem("selectedOption", selectedOption);
})
</script>
 
So we saved the selected value(subaccount) in the local storage.
But now we need the selected value as a filter, does anyone know how to use the selected value as filter?
Categories:
I have the same question (0)
  • Lucas001 Profile Picture
    2,559 Super User 2026 Season 1 on at

    Hi @Liesjee,

     

    have a look here after min 2:30 I think that's what you need.

    Once establishing the filter use your selected values and fill the filter with it. After that use jQuery to fire the Apply button and your filter should be applied as wanted.

    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

  • Liesjee Profile Picture
    6 on at

    Hi, Thanks for your answer. Unfortunately, is this filter for a specific list. In our case the user logs in, select a subaccount and should see all lists with that selected subaccount. 

     

    Liesjee_1-1697552054490.png

     

     

     

  • Lucas001 Profile Picture
    2,559 Super User 2026 Season 1 on at

    Hi @Liesjee,

     

    what is your approach here?

    If i get you right you want to display lists depending on the chosen items in your filter, correct?

     

    So you really want to have multiple lists or just one summary list which displays the name of the lists the subaccount is in?

     

  • Liesjee Profile Picture
    6 on at

    Hi @Lucas001 ,

     

    As seen in the image I've created a dropdown with subaccounts with Javascript. The user selects one of those subaccounts in the dropdown and that selected subaccount should be used as filter for multiple lists.

  • Verified answer
    Lucas001 Profile Picture
    2,559 Super User 2026 Season 1 on at

    Hi @Liesjee,

     

    I will talk about the example at min 5 from the video I posted above .

    As the filter does not need a page refresh you can create all your lists and enable the filter for all your lists.

    Use your dropdown which you created and use the on select, click or change trigger, depends on what works best for you and create a variable with JQuery to that selected item.

    Use the variable and populate all input fields for the filter in all your lists with JS again. After that fire all the onselect-button properties of all your filter buttons for the lists. Maybe you can use a for loop depending on the name of all the selectors of those inputs.

     

    In the end all your lists should now have an applied filter to the chosen value of your dropdown.

     

    If you don't want to let the people filter themselves, .hide() the entire filter container on top of the document.ready function.

    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Valantis Profile Picture

Valantis 59

#2
11manish Profile Picture

11manish 51

#3
omkarsupreme Profile Picture

omkarsupreme 27

Last 30 days Overall leaderboard