简体   繁体   English

在MS Dynamics Crm 2011中使用工作流创建电子邮件,并动态填写“收件人”字段

[英]Create Email with a workflow in MS Dynamics Crm 2011 and dynamically fill the “To” field

I'm working on Ms Dynamics Crm 2011 development and I encountered following problem. 我正在开发Dynamics Crm 2011女士,遇到以下问题。 My situation: 我的情况:

I want to be able to automatically send an Email after a change on a specific status field on a record of the Entity "MyEntity". 我希望能够在对实体“ MyEntity”的记录中的特定状态字段进行更改后自动发送电子邮件。 "MyEntity" has an Email-field. “ MyEntity”具有一个电子邮件字段。 I try to create a workflow which sends an Email to the Email-field address of the "MyEntity" record after the status has been changed. 我尝试创建一个工作流,该工作流在状态更改后将电子邮件发送到“ MyEntity”记录的电子邮件字段地址。 My problem is that I can't add in the Email Creation workflow to the "To" field this "MyEntity" Email-field adress. 我的问题是我无法在“电子邮件创建”工作流中将此“ MyEntity”电子邮件字段地址添加到“收件人”字段。 I need to somehow specify in the workflow to dynamically add the "To" field, the relating Email address from the specific "MyEntity". 我需要以某种方式在工作流中指定以动态添加“收件人”字段,即来自特定“ MyEntity”的相关电子邮件地址。 Is that possible? 那可能吗? Is there a workaround for that? 有没有解决方法? It could be done with a plugin I guess, but by now I'm trying to avoid the plugin solution. 我猜可以用一个插件来完成,但是到现在为止,我正在尝试避免使用插件解决方案。

Thanks in advance 提前致谢

John 约翰

Yes, you should be able to. 是的,您应该能够。 First go to Solutions, bring up your entity, go to Fields, bring up your e-mail field and ensure the Format is e-mail. 首先转到解决方案,打开您的实体,转到字段,打开您的电子邮件字段,并确保格式为电子邮件。 Publish. 发布。

Work around: If you have more than 1 e-mail Format text field, change the others temporarily (to text from e-mail) and Publish. 解决方法:如果您有多个“电子邮件格式”文本字段,请暂时更改其他(从电子邮件中发送文本)并发布。 Otherwise, the next step is ambiguous and we don't have control over which field CRM sets up as the email to use when this entity is used for e-mail. 否则,下一步将是模棱两可的,并且当该实体用于电子邮件时,我们无法控制将CRM设置为要使用的电子邮件字段。

In the solution frame, select your entity node in the tree. 在解决方案框架中,在树中选择您的实体节点。 Under Communication and Collaboration, check the box 'Sending e-mail (If an e-mail field does not exist, one will be created).' 在“通信和协作”下,选中“发送电子邮件(如果不存在电子邮件字段,将创建一个电子邮件字段)”框。 Save/Publish. 保存/发表。

Fix the work around above if you had more than 1 e-mail format text field. 如果您有多个电子邮件格式文本字段,请解决以上问题。 Change them back to e-mail. 将其更改回电子邮件。 Publish. 发布。

In Workflow, select your To Field. 在工作流中,选择“到”字段。 Under the Send e-mail step, select 'Set Properties.' 在“发送电子邮件”步骤下,选择“设置属性”。 Select the 'To' field. 选择“收件人”字段。 In the form assistant you should not be able to select your entity. 在表单助手中,您不应选择您的实体。 NOTE: You will bind to the 'Key' field and NOT to the particular e-mail field. 注意:您将绑定到“密钥”字段,而不绑定到特定的电子邮件字段。

This only works for a single e-mail field on your custom entity. 这仅适用于您的自定义实体上的单个电子邮件字段。 There is no way to use a text field as an address in a CRM 'to' field. 无法将文本字段用作CRM“收件人”字段中的地址。

Unfortunately you cannot. 不幸的是你不能。

Out of the box the To field in an email accepts only 开箱即用的电子邮件中的“ 收件人”字段仅接受

  • Account 帐户
  • Contact 联系
  • Facility/Equipment 设施/设备
  • Lead
  • Queue 队列
  • User 用户

So in order to achieve the goal , you will have to write a custom workflow activity (optional : taking the custom text field in your input parameter )and refer it in your workflow or develop a plug-in. 因此,为了实现该目标,您将必须编写一个自定义工作流活动(可选:在输入参数中输入自定义文本字段),然后在工作流中引用它或开发一个插件。

Sample code for Plugin : 插件的示例代码

SendEmailRequest req = new SendEmailRequest();
req.EmailId = emailId;//ID of created mail
req.TrackingToken = "";
req.IssueSend = true;

For more information check this post Crm 2011 :Workflow - Sending email problem 有关更多信息,请检查此帖子Crm 2011:工作流程-发送电子邮件问题

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

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