Leonid Shirmanov


I have a question regarding State Machine Workflow implementation.

My situation is like this: I have several states like IssueCreated, IssueAssigned etc and let's say that IssueCreated state has two EvenDriven activities. The first is ussual listening to an external event and setting to IssueAssigned status and the second is a Delay for an hour and sending an email after. IssueAssigned is listening to another external event - IssueOpen.

When IssueCreated recieves an external event it sets the workflow to IssueAssigned state and delay is started. I need the next thing - if IssueAssigned state recieves its external event IssueOpen it should move the workflow to the next state (that's ok) and should cancel delaying and sending an email started in IssueCreated in case of that email is not sent yet.

Perhaps I'm wrong in my thoughts how this thing should be implemented using WF. Could you please advice something


Re: Windows Workflow Foundation State Workflow - How can I do that?

Vignesh Kannappan - MSFT

Hi Leonid -

From your description it looks like you want the delay in the IssueAssigned state, which makes only one event in the IssueCreated (not two as you have stated initially). Here is how I would try to accomplish your scenario:

IssueCreated State

-- listening for external event; then setState to IssueAssigned State

IssueAssigned State

-- one eventdriven listening to second external event, then setState to the next state (if any) or the final state

-- second eventdriven with the delay activity for 1 hr, followed by sendemail activity, then setstate to next state

Notice in the IssueAssigned state, if the external event doesn't arrive within the 1hr delay time, mail will be sent and transition to next state made. If the external event does arrive, the delay wont be processed and mail not sent which is what you want and is the default bahavior.