【问题标题】:Auto-populate fields in email form in Dynamics CRM 2011在 Dynamics CRM 2011 中的电子邮件表单中自动填充字段
【发布时间】:2011-06-27 11:30:22
【问题描述】:

想象一下,您想在案例中添加一封电子邮件。电子邮件表单打开,“收件人”字段自动填充案例的客户帐户。

我想更改行为,以便使用相关案例的自定义属性自动填充“To”的内容。

我的第一种方法是为表单的 OnLoad 事件注册一个 JavaScript,并让脚本更改字段。那会奏效,但我想知道是否有更聪明的方法来实现这一目标。已经有一些逻辑填充了“To”字段。 是否可以配置此现有功能

感谢任何提示。

【问题讨论】:

  • @downvoter:这个问题有什么问题?

标签: dynamics-crm dynamics-crm-2011


【解决方案1】:

我不相信这个特定场景可以比您已经解决的方法更有效地完成。我会建议查看数据映射(当您在实体的自定义中弹出打开关系时,左侧导航项,与此 Dynamics CRM 4.0 文章http://www.dynamicscare.com/blog/index.php/modifying-mapping-behavior-between-parent-child-records-in-microsoft-dynamics-crm/ 中讨论的概念相同),但它似乎不适用于这种关系。

【讨论】:

    【解决方案2】:

    这可能会对您有所帮助:

               DataService.EntityReference toEntityRef = new DataService.EntityReference();
                toEntityRef.LogicalName = "contact";
                toEntityRef.Id = Guid.Parse(to_id);
                Entity toParty = new Entity();
                toParty["partyid"] = toEntityRef;
                toParty.LogicalName = "activityparty";
                Entity emailEntity = new Entity();
                emailEntity.LogicalName = "email";
                EntityCollection toCollection = new EntityCollection();
                toCollection.Entities = new ObservableCollection<Entity>();
                toCollection.Entities.Add(toParty);
                emailEntity["to"] = toCollection;
               IOrganizationService soapService = ServerUtility.GetSoapService();
               IAsyncResult res = soapService.BeginCreate(emailEntity, OnCreateComplete, soapService);
    

    回调方法:

        private void OnCreateComplete(IAsyncResult result)
        {                 
                 Guid emailId = (IOrganizationService)result.AsyncState).EndCreate(result);
        }
    

    【讨论】:

      【解决方案3】:

      另一种方法是替换功能区中的 添加电子邮件 按钮,以调用自定义 JavaScript 函数。这个函数可以用window.open打开邮件窗口,用setting the extraqs parameter初始化To:字段,为即将创建的邮件配置一个ActivityParty。这可以通过设置来完成:

      • partyid 到允许的实体实例的 id
      • partyname 到实体实例的名称
      • partytype 到 2(对于配方字段,请参阅 here for details

      extraqs 参数有限制:您只能设置一个接收方,不能设置其他字段(发件人、抄送、密送...)。此外,替换按钮将绕过内置功能,这可能会在未来的版本中发生变化,

      所以我更喜欢表单的 OnLoad 事件的处理。

      【讨论】:

      • 触摸,那将是另一种方式。替换按钮或覆盖其命令定义。如果您期望更改 onLoad 绝对是要走的路。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-12
      • 1970-01-01
      • 2012-11-13
      • 2012-05-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多