Policy Activity

Intertech Tutorials

Working with the Policy Activity and Rule Sets

The Policy activity can be very useful when you have to run a set of rules at a certain point in your workflow. Assume you have a workflow that receives an incoming sales item describing the cost of the item and the number of items bought (e.g., 100 books at $20.00 each). Now assume you have a set of rules that will adjust the total cost based on how many books were bought. If the number of books is greater than 40, the order receives a discount. Also assume if the sale is greater than 50 books, the order receives a shipping discount.

These two rules could be accounted for in a ‘hardcoded’ way using a Code activity. As an alternative, you could define a single Policy activity, which declaratively defines a ‘rule set’ to account for each rule.

wf28

Once a Policy activity has been placed on your WF designer, you are able to set the RuleSetReference property to create your rule set. To do so, you will make use of the same RuleSet editor, which works similarly to the Rule Condition editor. Your upcoming lab will walk you through the details of building a rule set.

wf29

Like a Rule Condition, a RuleSet can be very useful in that your conditional logic is not hardcoded within your assembly but via a *.rules file. Again, this allows for the possibility of changing rules on the fly without recompiling your code base.


Copyright (c) 2008-2013. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an online learning aid. Any attempts to copy, reproduce, or use for training is strictly prohibited.