posted on Thursday, April 27, 2006 7:53 AM by BayerWhite

HandleExternalEvent Activity Requirements

While preparing for my next speaking engagement on WF, I came across an issue that cot me many many hours of time. I am not sure if it was because I took an unfortunate break from WF while training clients on ASP.Net 2.0, or if I still would have ran into the issue anyway. My problem was that my HandleExternalEvent Activity was not receiving the event when fired from my service. So I pulled up another example that I have used in many of my previous sessions and studied the differences of how I had wired it. I even thought that I had found a bug that I could report back since WF is beta, but the bug was mine! So instead of you having to deal with the same issue, I decided to share it and also list the requirements for using the activity.

  1. Must have an Interface to use as a contract with the HandleExternalEvent Activity
    • ExternalDataExchange attribute must be set for the Interface...ex. [ExternalDataExchange]
  2. When using custom EventArgs, make sure that they inherit from ExternalDataEventArgs and that the object is Serializable... ex. [Serializable] public class RentalArgs : ExternalDataEventArgs
    • HERE WAS MY PROBLEM...if one of your members returns another custom object, MAKE SURE THAT OBJECT IS SERIALIZABLE TOO...[Serializable]
    • Your custom args object will have an instanceId base property from inheriting from ExternalDataEventArgs, that should be set by the InstanceId of the workflow that is running
  3. Finally, make sure the service you build to implements the interface.

Want to learn more about WF or you can't afford TechEd! Come to Tampa TechEd Outcasts, June 12-16

# re: HandleExternalEvent Activity Requirements

Thursday, April 23, 2009 5:29 AM by venkatesh
hi,

I have created the sample state machine workflow in asp.net by VB code, with two states. the first state has state initialization and event driven activity, and the second state has state initialization. when start the workflow, it works fine at the initial state. when i raise a event using the handle external event activity it doesn't move to next state.

I know that i have made a mistake, but couldn't able to trace. Can any one help me

Thanks in advance

Venkatesh

# OFhyipwuYg

Sunday, June 13, 2010 2:55 PM by mtabonfpho
What do you think?
(required) 
required 
optional
required