Hi
I have a scenario where I have a list form where “function” (Managed Metadata), on value selection I am looking only show information in “Documents” lookup column. Documents is a document Library storing set of documents with a “Function” metadata field.
In the list form I have configured the “Documents” to return “extra field - DLLevel1/Title. Below script isn’t filtering the options. Any ideas?
const updateDocumentFilter = () => {
const selectedFunction = fd.field('Function').value?.[0]?.name;
if (!selectedFunction) {
fd.field('Document').filter = null;
} else {
fd.field('Document').filter = function(item) {
const docFunction = item['DLLevel1/Title']; // This is the returned extra field
return docFunction?.toLowerCase().trim() === selectedFunction.toLowerCase().trim();
};
}
fd.field('Document').refresh();
};
// Initial filter on load
updateDocumentFilter();
// Re-filter whenever Function changes
fd.field('Function').$on('change', updateDocumentFilter);
});