CRM 2013 Javascript Filter Custom Lookup View Field (PreFiltering Method)


Issues:

Changes in category effect custom filtering, then the lookup display on form will corrupt but when u click on lookup more its ok.

Script:

var filter = '';

function FilterListingViewCategory(Value) {
    filter = "<filter type='and'>" +
              "<condition attribute='statecode' operator='eq' value='0' />" +
              "<condition attribute='vwlzs_category' operator='in'>" +
                "<value>" + RegistrationId + "</value>" +
              "</condition>" +
         "</filter>";

    preFilterLookupCategory(filter);
}

function preFilterLookupCategory(filter) {

    Xrm.Page.getControl("vwlzs_aidcategorylk").addPreSearch(function () {
        addLookupFilterCategory(filter);
    });
}

function addLookupFilterCategory(filter) {

    Xrm.Page.getControl("vwlzs_aidcategorylk").addCustomFilter(filter);
}

0 comments: