Home Ask Login Register

Developers Planet

Your answer is one click away!

plusheen February 2016

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, i.e. 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.



Renjith February 2016


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.

Post Status

Asked in February 2016
Viewed 1,357 times
Voted 9
Answered 1 times


Leave an answer

Quote of the day: live life