【问题标题】:Show specific account records in account lookup in Dynamics CRM在 Dynamics CRM 中的帐户查找中显示特定的帐户记录
【发布时间】: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


    【解决方案1】:

    您在addCustomFilter 中指定的 FetchXML 仅作为&lt;filter&gt; 部分。使用addCustomFilter时不能指定链接实体。

    如果您无法简化查询,只需要考虑 Account 实体上的字段,则必须使用 addCustomView 而不是 addCustomFilter

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多