简体   繁体   中英

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. 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.

So, using above example, the custom workflow is run when a CRM field changes. The workflow calls a web service, which times out. The workflow then picks up that it was a TimeoutException , and adds a step to retry the workflow. The workflow restarts, and throws an 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,

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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