简体   繁体   English

查找联系人而不是MS Dynamics CRM 2013中的电子邮件帐户

[英]Lookup contacts instead of accounts on emails in MS Dynamics CRM 2013

I planning change default view for to attribute on email entity, so instead of account entity it will suggest user to choose recipients among contacts . 我计划更改默认视图toemail实体上to属性,因此它将建议用户在contacts选择收件人而不是account实体。

However this functionality in MS Dynamics CRM seems to be broken. 但是,MS Dynamics CRM中的此功能似乎已被破坏。 Or I missing something? 或者我错过了什么?

Here is the code: 这是代码:

(function () {
    var ctrl = Xrm.Page.getControl("to");

    if (ctrl) {
        ctrl.setDefaultView('{13C1A58B-9AEF-4164-80E5-1D946D5BC8B3}');
        console.log("Default view is set!");
    }
}())

Guid points to valid view on contact entity. Guid指向contact实体的有效视图。 The code is executed, console has debug message Default view is set! 代码执行,控制台有调试消息默认视图设置! , and on using to lookup system still uses account by default. ,并使用to检索系统仍然使用account默认。

Did somebody found workaround for this issue? 有人找到了解决此问题的方法吗? In supported way, of course. 当然,以支持的方式。

I was lucky to find supported, but still a bit tricky way how to achieve needed result without hacking CRM core. 我很幸运能够找到支持,但仍然有点棘手的方法如何在不破坏CRM核心的情况下实现所需的结果。

The basic idea is to add any custom view to selected control, and than setDefaultView to any needed view that valid for the entity. 基本思想是向所选控件添加任何自定义视图 ,并将setDefaultView到对实体有效的任何所需视图

So code in the question could be rewritten as: 因此,问题中的代码可以重写为:

(function () {
    var ctrl = Xrm.Page.getControl("to");

    if (ctrl) {
        // Add custom view based 
        ctrl.addCustomView('{71C254C1-1F55-43B7-94DE-C461DB617A77}', 'contact', 'View Name', '<xml> valid FetchXML statement </xml>', '<xml> valid LayoutXML statement </xml>', true);
        ctrl.setDefaultView('{13C1A58B-9AEF-4164-80E5-1D946D5BC8B3}');
        console.log("Default view is set!");
    }
}())

Actually after new custom view is set, any valid view could be set as default. 实际上,在设置新的自定义视图后,可以将任何有效视图设置为默认视图。 This could be either custom or system view. 这可以是自定义视图或系统视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM