Add Custom Filter for Lookup in Dynamics CRM

Welcome to my old Blogspot blog! You can read this post on our new website: Read this post on our new website 

Following is a code snippet for adding custom filter in lookup in dynamics CRM.

function onPageLoad()
{
    var LookupControl = Xrm.Page.getControl("new_marketinglist");
    if (LookupControl != null) {
        var fetchXml = "<filter type='and'><condition attribute='createdfromcode' operator='eq' value='2' /></filter>";
        LookupControl.addPreSearch(function () {
            LookupControl.addCustomFilter(fetchXml);
        });
    }
}

No comments:

Post a Comment