Hi all,
I have a lookup field which is filtered by an optionset using this function :
function preFilterLookup() {
Xrm.Page.getControl("lookupAttribute").addPreSearch(function () {
addLookupFilter();
});
}
function addLookupFilter() {
var optionSet= Xrm.Page.getAttribute("optionSetAttribute").getValue();
if (optionSet!= null) {
fetchXml = "<filter type='and'><condition attribute='optionSetAttribute' operator='eq' value='" + optionSet+ "' /></filter>";
Xrm.Page.getControl("lookupAttribute").addCustomFilter(fetchXml);
I wanted to have it so that if we change the option Set then the look up is emptied so that the user can choose from a new set of values. I did it with :
function optionSet_onChange() {
var lookUp= Xrm.Page.getAttribute("lookupAttribute");
if (lookUp!= null) {
lookUp.setValue(null);
}
However the field is never reset to null. The weirdest part is that it did work a few times at first but since then nothing.
Do any of you have any idea how that could of happened ?
Cheers
Simon
*This post is locked for comments