Hello Friends,
I am facing a new issue that i am unable to add custom filter to the lookup field.
Because the addSearchFilter() is not working on the Model Driven Apps.
Here is the code that i'm using
// JavaScript source code
function preFilterLookup() {
debugger;
try {
if (Xrm.Page.getControl("crda6_product") != null && Xrm.Page.getControl("crda6_product") != undefined) {
Xrm.Page.getControl("crda6_product").addPreSearch(addCustomeLookupFilter);
}
} catch (e) {
throw new Error(e.Message);
}
}
function addCustomeLookupFilter() {
var functionName = "addCustomeLookupFilter";
try {
var formvalue = Xrm.Page.getAttribute("crda6_origin").getValue();
if (formvalue != null && formvalue != undefined) {
fetchXml = " <filter type='and'><condition attribute='crda6_origin' operator='like' value='%import%' /></filter>";
Xrm.Page.getControl("crda6_product").addCustomFilter(fetchXml);
}
} catch (e) {
throw new Error(e.Message);
}
}
If anyone has any information on this issue please let know that would be very helpful.
Regards
Shashikant Saxena