【问题标题】:Default the "Look for" field in a lookup view在查找视图中默认“查找”字段
【发布时间】:2016-03-09 06:24:25
【问题描述】:

如果“查找”下拉菜单包含多个项目(例如帐户、联系人),是否可以设置默认选项(在我的场景中为第二个选项联系人)?

【问题讨论】:

  • 搜索“是否可以设置默认选项 CRM 查找”会产生许多结果,包括上述评论中添加的结果。在提出问题之前,请尝试表明您已经进行了一些研究。
  • 感谢您的帮助。我在搜索时使用了我认为错误的术语。
  • 您要更改默认设置,还是阻止用户选择帐户?在后一种情况下,您可以手动编辑解决方案 XML。

标签: dynamics-crm-2011 dynamics-crm dynamics-crm-2013


【解决方案1】:

在 CRM 2015 中,如果要过滤查找以使其仅包含联系人,则可以使用以下内容

// Filter the dropdown of the lookup so that it only contains contacts + do not allow accounts ,in the contact views, visible when the user clicks more records
    var noAccountsfilter = "<filter type='and'><condition attribute='statecode' operator='ne' value='0' /></filter>";
    Xrm.Page.getControl("parentcustomerid").addCustomFilter(noAccountsfilter, 'account');

【讨论】:

    【解决方案2】:
    function Form_OnLoad()
    ...
    preFilterLookup();
    ..
    }
    
    
     function preFilterLookup() {
     Xrm.Page.getControl("customerid").addPreSearch(addLookupFilter);
     } 
    
     function addLookupFilter() {
    
     document.getElementById("customerid_i").setAttribute        ("lookuptypenames", "contact:2:Contact");
     document.getElementById("customerid_i").setAttribute("lookuptypes", "2");
     }
    

    How do I change the default quick form for the CustomerId field in Dynamics CRM 2013?

    【讨论】:

    • 该代码不适用于 CRM 2015 SP1/2016。祝你升级顺利。
    • 如果真的需要处理这个问题,你应该有一个 OnChange js 来询问记录类型,如果它不匹配,请清除查找中的值。
    • @AndriiButenko 公平地说,这个问题被标记为 2013,所以这个答案应该在这种环境下工作。使用在未来版本中已弃用的不受支持的代码并不是一个好习惯
    • 这是一件好事,至少可以说这不是您“应该”编写代码的方式,并且在 MS 进行任何更新后它可能无法正常工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多