I'm working on a form with three lookup fields: Building, Floor, and Location. The dependencies are as follows:
- Building no dependency (ex: bldg1 bldg2 bldg3)
- Floor is dependent on Building (ex: Floors: 1, 2, 3, 4).
- Location is dependent on Floor (ex: Locations: rm1, rm2, conf, rw5).
I have no issues filtering the Building field based on conditions, but I'm encountering problems when trying to filter the Location field. Specifically, I want to remove "conf" from the choices when the RequestType field is set to "Meeting."
Has anyone encountered a similar issue or have suggestions for filtering dependent lookup fields effectively? Any guidance would be appreciated.
Filtering Building (works - no dependency)
fd.spRendered(function () {
function FilterBldg() {
if (fd.field('RequestType').value.LookupValue == 'Other') {
fd.field('Buildings').filter = "Title ne 'bldg3'";
fd.field('Buildings').refresh();
fd.field('Buildings').clear();
} else {
fd.field('Buildings').filter = "Title ne ''";
fd.field('Buildings').refresh();
fd.field('Buildings').clear();
} }
fd.field('RequestType').$on('change', FilterBldg);
FilterBldg();
});
Filtering Location (not working - has dependency )
fd.spRendered(function () {
function FilterBldg2() {
if (fd.field('RequestType').value && fd.field('RequestType').value.LookupValue == 'Meeting' ) {
fd.field('Location0').filter = "Title ne 'conf'";
fd.field('Location0').refresh();
fd.field('Location0').clear();
} else {
fd.field('Location0').filter = "Title ne ''";
fd.field('Location0').refresh();
fd.field('Location0').clear();
}
}
fd.field('RequestType').$on('change', FilterBldg2);
fd.field('Floor').$on('change', FilterBldg2);
FilterBldg2();
});