web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Updating the PreSearch Filter

(0) ShareShare
ReportReport
Posted on by 51

I require some coding help with removing a presearchfilter that has applied, if the other field has changed.

So there is the "subjectid" lookup control, which you select the parent subject, then the "int_category" is filtered to show only the children of the selected subject.

Currently the code works, unless you change the subject, the lookup values in the category's still shows the previous filtered values.

Current code is below, and the on change event for subjectid control runs filterCaseCategory

function filterCaseCategory() {
  Xrm.Page.getControl("int_category").addPreSearch(addCategoryilter);
}

function addCategoryilter() {
  if (Xrm.Page.data.entity.attributes.get("subjectid").getValue() != null) {
    var subjectvalue = Xrm.Page.getAttribute("subjectid").getValue()[0].id;
    var subjectvalueguid = subjectvalue.substring(1, subjectvalue.length - 1);
    var CategoryFilter = "";
    Xrm.Page.getControl("int_category").addCustomFilter(CategoryFilter, "subject");
  }
}

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 125

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 110 Super User 2025 Season 2

#3
Erin Lubben Profile Picture

Erin Lubben 73

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans