Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

Set Default filter values and click 'Apply Filters' with JavaScript

Posted on by 5

Hi all,

Newcomer to the Portals/Dynamics space here.

My question relates to using Custom JavaScript to set and apply filters for a List on a Portals page.

Context:

I have a list showing all of our Projects. Metadata filters are enabled and three Attribute Filters have been set up (all working as expected).

What I'm hoping to achieve is that of the three filters, the 'Status' filter will default to 'Active' and said filter will be applied when the page loads up.

I have used the following custom Jscript to try and achieve this (plus a plethora of similar alternatives that all boil down to essentially the same approach):

pastedimage1667489345362v3.png
The result is that the 'Status' dropdown does default to 'Active' (see image below), however the part of the function that should click the 'Apply Filters' button does not seem to work. Alternatively, perhaps this click happens too soon such that the table isn't fully loaded/ ready for the filters to be applied when the click goes off?

pastedimage1667488879793v2.png

(See above, Status filter set to 'Active' - however the list below has not been filtered; the 'Apply Filters' button still needs to be clicked manually, whereafter the list is filtered as expected)

Any advice as to the best way to achieve this would be great! Ultimately having the applicable filter set, displayed and applied as indicated above would be ideal.
Thanks!
JB
  • SKPForYou Profile Picture
    SKPForYou on at
    RE: Set Default filter values and click 'Apply Filters' with JavaScript

    Hi Jaybee91, Did you find a solution for this?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans