Webturner

I'm modelling the complaints system for our company and part of the process involves automatically sending out standard letters after 4 and 8 weeks and automatically closing a complaint after 16 weeks. These delays run from when the complaint is first registered while the handler is dealing with the complaint or waiting for responses from the customer. This is my first model in WF.

At the moment I have a listen activity with four branches. One is triggered by a user resolving the complaint, which closes it. The other three are triggered by delays, two then send a letter, the last quietly closes the complaint.

This listen activity is in a while activity that loops until the complaint is closed.

Would a ConditionedActivityGroup be more appropriate Can it respond to the events and delays that I have in the listen activity Will it make it easier using its until and when conditions

I'm thinking that the listen/while solution will do the job, I just don't know enough about the CAG to know if it will do the job better.




Re: Windows Workflow Foundation Should I use a CAG or a Listen inside a While?

Laurence Melloul - MSFT

Hi,

Your design is more appropriate than the CAG activity. The CAG activity is useful when the activities that get executed in the CAG change the conditions in the CAG's ruleset, and hence allows you to keep interating through the CAG till you converge to the final result.

So the While/Listen combination is good. However, you want to avoid the three Delays as children of the same Listen, because the Delay with the smallest timeout duration will always be the one to execute.

Instead, you may want to encapsulate one Delay activity in an EventDriveActivity that keeps track of an "attempt" variable you will increment as you go through the While loop. You can use the IntitializeTimeoutDuration to intialize the Delay timeout at runtime for each loop based on the attempt index. You may also define the next activities to execute based on the attempt index.

Hope this helps.