【发布时间】:2017-03-14 15:47:42
【问题描述】:
我在帐户和关系类型(自定义实体)之间有 N:N 关系。现在在记录实体(另一个自定义实体)上,我有一个帐户查找,我想添加预搜索条件,以便查找只能显示在关系类型中具有“供应商”关系的特定对象。到目前为止,我已经按照 sn-p 进行查找预搜索,但它显示了所有记录。我不确定我在哪里做错了。有什么想法/建议吗?
function filterAccounts() {
try {
debugger;
var accountLookup = Xrm.Page.getControl("new_accountid");
if (accountLookup == null && accountLookup == 'undefined') { }
else {
accountLookup.addPreSearch(function () {
CustomFilter(accountLookup);
});
}
} catch (e) {
alert("Error: " + e.message);
}
}
function CustomFilter(accountLookup) {
try {
debugger;
var fetchXml = "<link-entity name='new_account_new_relationshiptype' from='accountid' to='accountid' visible='false' intersect='true'>" +
" <link-entity name='new_relationshiptype' from='new_relationshiptypeid' to='new_relationshiptypeid' alias='ak'>" +
" <filter type='and'>" +
" <condition attribute='new_name' operator='eq' value='Vendor' />" +
" </filter>" +
" </link-entity>" +
" </link-entity>";
accountLookup.addCustomFilter(fetchXml);
} catch (e) {
alert("Error: " + e.message);
}
}
【问题讨论】:
标签: javascript account dynamics-crm-2016