简体   繁体   English

退出自定义C#CRM工作流回到设计器工作流

[英]Exit custom C# CRM Workflow back into designer workflow

I'm developing a few custom CRM workflows, and some of them require e-mails to be sent. 我正在开发一些自定义的CRM工作流,其中一些需要发送电子邮件。 As far as i'm aware, this can't be done through code. 据我所知,这不能通过代码来完成。 What I would like to achieve is - to run some custom code, and depending on what happens during that code, ie a timeout exception to a web service throws an exception or a validation error occurs for said web service, the workflow will either retry or send an email out. 我想实现的是-运行一些自定义代码,并根据该代码期间发生的情况(即Web服务的超时异常引发异常或该Web服务发生验证错误),工作流将重试或发送电子邮件。

So, using above example, the custom workflow is run when a CRM field changes. 因此,使用上面的示例,当CRM字段更改时,将运行自定义工作流程。 The workflow calls a web service, which times out. 工作流调用Web服务,该服务超时。 The workflow then picks up that it was a TimeoutException , and adds a step to retry the workflow. 然后,工作流发现它是TimeoutException ,并添加了重试工作流的步骤。 The workflow restarts, and throws an ArgumentException . 工作流将重新启动,并引发ArgumentException The workflow picks up this exception, and sets a field in the form. 工作流将拾取此异常,并在表单中设置一个字段。 (I understand this can be done in the code, it is just an example, as I wish to use this functionality for many areas in many workflows!) (我理解这可以在代码中完成,这只是一个示例,因为我希望将此功能用于许多工作流中的许多领域!)

The only way I thought of was to have a new field on the form called Workflow Action, have the workflow detect changes, and the custom code changes this field. 我想到的唯一方法是在表单上创建一个名为“工作流操作”的新字段,让工作流检测更改,然后自定义代码更改此字段。 The workflow knows what status it has changed to and behaves accordingly. 工作流知道其已更改为什么状态并相应地执行操作。

Thanks. 谢谢。

Plusheen, Plusheen,

You can set an output parameter in your custom code based on your requirement and access that in your next step in out of the box workflow designer. 您可以根据需要在自定义代码中设置输出参数,并在下一步中直接使用该参数。 Use a condition expression in the designer to check the output and do what you want to do based on the result from the Custom code. 在设计器中使用条件表达式检查输出,并根据“定制”代码的结果执行所需的操作。

Hope this is something what you were looking for. 希望这是您想要的东西。 Let me know if you need any more information. 让我知道您是否需要更多信息。

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

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