Condition and Rule Activities in Workflow
Condition and Rule Activities in Workflow
By : Kasim Wirama, MCDBA, MVP SQL Server
On my previous article (implement multiple activities in workflow), on last passage, I talk a bit about Condition property on IfElse and While activities. Not only these 2 activities implement this, but also another activity, they are ConditionedActivityGroup and PolicyActivity. Let’s take a look each of them.
ConditionedActivityGroup (CAG) enable you put multiple activities, if you put container-type activity, you can put activiti(es) inside the activity, for example, drag CAGto IDE of Visual Studio designer. First drag SequenceActivity into upper box of CAG, turn on edit mode by pressing button below upper text box, and drag several code activity group into it. Next you drag While activity into upper text box, put it beside SequenceActivity, and add new code activity group inside the While activity, then put code activity beside While activity in upper text box. You see that CAG could contain both container type activities and non-container type activities.
Moreover notice that each member of activities inside upper text box of CAG, each of them has WhenCondition property. And CAG contains UntilCondition property. Both UntilCondition and WhenCondition property contains options to specify condition declaratively (by putting it into separate readable rule file) or imperatively (by code embedded in WWF assembly). Each of member of activities in upper box is executed until each of them returns to false condition while CAG’s UntilCondition property will determine execution looping until it is evaluated as true for each execution completion of each of activities inside upper text box. If you do not specify WhenCondition in member activities inside the upper textbox, it will be executed once, if you do not specify UntilCondition, all member will be executed until value of WhenCondition is evaluated as false for all of them.
PolicyActivity enables you declare business rule that compose a rule set. A rule set is a series of rule. And each of them contains conditions and actions for true condition and false condition. you can specify them in Rule Set Editor window.