CRM lookup筛选

function Loadcouse() {
var type;
var id;
retrieveRecord(Xrm.Page.getAttribute("ownerid").getValue()[0].id, "SystemUserSet", function (data, textStatus, XmlHttpRequest) {
if (data.BusinessUnitId.Id != null) {
retrieveRecord(data.BusinessUnitId.Id, "BusinessUnitSet", function (data1, textStatus, XmlHttpRequest) {
if (data1.new_city.Id != null) {
retrieveRecord(data1.new_city.Id, "new_citySet", function (data2, textStatus, XmlHttpRequest) {
type = data2.new_citytype.Value;
id = data1.new_city.Id;

Xrm.Page.getControl("new_coursename").addPreSearch(function () {
var fetchxml;
if (type = 100000001) {
方法一使用fetch: fetchxml = "<filter type='and'>" +
"<condition attribute='new_city' operator='in'>" +
"<value uiname='全国' uitype='new_city'>{DD499663-C15D-E411-80DC-000C2957EC4F}</value>" +
"<value uiname='TMM城市' uitype='new_city'>{A13A532E-03E8-E411-80F2-000C2957EC4F}</value>" +
"<value uitype='new_city'>"+id+"</value>" +
"</condition>" +
"</filter>"
}
else if (type = 100000000) {
fetchxml = "<filter type='and'>" +
"<condition attribute='new_city' operator='in'>" +
"<value uiname='全国' uitype='new_city'>{DD499663-C15D-E411-80DC-000C2957EC4F}</value>" +
"<value uiname='戴耐德城市' uitype='new_city'>{FD6103AD-03E8-E411-80F2-000C2957EC4F}</value>" +
"<value uitype='new_city'>" + id + "</value>" +
"</condition>" +
"</filter>"
}
Xrm.Page.getControl("new_coursename").addCustomFilter(fetchxml);
});
});
}
});
}
});
}

posted @ 2018-07-16 16:32  周捷Jay  阅读(336)  评论(0编辑  收藏  举报