首页 > 解决方案 > 业务流程中的查找过滤器

问题描述

我尝试更改“现有联系人?”字段的查找过滤器。(在 Lead 流程中)但我无法访问该字段的属性。

在此处输入图像描述

标签: dynamics-crmmicrosoft-dynamicsdynamics-365

解决方案


不幸的是,无法访问 BPF 字段属性窗口,并且无法像我们在表单部分中进行任何其他查找一样自定义查找字段属性。

但是有一种方法,我们可以使用 Javascript 来应用查找过滤器 usingaddPreSearch方法。这是完全支持的。阅读更多

function filterBpfLookup = function(formContext){
    if (formContext.getControl("header_process_mag_contactlookupid") != null){
        formContext.getControl("header_process_mag_contactlookupid").addPreSearch(filterDefinition);
    }
}

function filterDefinition = function(formContext) {
     var accountId = null;
     var accountLookup;
     var filterBpf;

     if (formContext.getControl("header_process_mag_contactlookupid") != null &&
     formContext.getControl("header_process_mag_contactlookupid").getAttribute().getValue() !=  null){
         accountLookup = formContext.getControl("header_process_mag_accountlookupid").getAttribute().getValue();
         accountId = accountLookup[0].id;

         if (accountId != null || accountId != undefined){
             filterBpf = "<filter type='and'>" + 
             "<condition attribute='mag_accountlookupid' operator='eq' value='" + accountId + "' />" +
             "</filter>";

             formContext.getControl("header_process_mag_contactlookupid").addCustomFilter(filterBpf);
         }
     }
 }

推荐阅读