function preFilterLookup() {
//终端业态
Xrm.Page.getControl("new_typeofoperationid").addPreSearch(function () {
addLookupFilter();
});
}
function addLookupFilter() {
var customertypecode = Xrm.Page.getAttribute("customertypecode").getValue(); //客户类型
if (customertypecode != null) {
fetchXml = "<filter type='and'><condition attribute='new_customertypecode' operator='eq' value='" + customertypecode + "' /></filter>";
Xrm.Page.getControl("new_typeofoperationid").addCustomFilter(fetchXml);
}
}
以上代码指在实现,以下功能:
1 当选择客户类型时,自动按选择后的 客户类型去过滤 终端业态这个lookup.
2 这两个函数应该放在 客户类型的onchange事件中比较好.