The scenario is, there is one option set field, and when I select option set value based on that a lookup value should filter
function Tipologiaintervento(executionContext)
{
debugger;
var formContext=executionContext.getFormContext();
if(formContext.getAttribute("new_tipologiaintervento").getValue!=null){
var tipologiaintervento= formContext.getAttribute("new_tipologiaintervento").getValue();
if (tipologiaintervento == 1 )
{
formContext.getControl("msdyn_workordertype").addPreSearch(filterlookup());
}
else
{
formContext.getControl("msdyn_workordertype").removePreSearch(filterlookup());
}
}
}
function filterlookup()
{
debugger;
var fetchxml = "<filter type='and'>"+
"<condition attribute='msdyn_workordertype' operator='eq' value='03A27F86-75C7-EB11-BACC-000D3A26E00B'/>"+
"<condition attribute='msdyn_workordertype' operator='eq' value='E4997BC9-6DBC-EB11-BACC-000D3A4980A5'/>"+
"</filter>";
formContext.getControl("msdyn_workordertype").addCustomFilter(fetchxml);
}







