Sun Identity Manager Deployment Reference

Using the LocalScope Option in Workflows

Even when arguments are passed explicitly to a rule, the system by default allows references to other variables that are not passed as explicit arguments. The following example shows a workflow action calling the rule but passing only one argument:

Example 4–20 Workflow Action Calling the Rule and Passing a Single Argument

      <setvar name=’email’> 
         <rule name=’generateEmail’> 
            <argument name=’firstname’ value=’$(employeeFirstname)’/> 

When the rule is evaluated, the workflow processor is asked to supply a value for the variable lastname. Even if there is a workflow variable with this name, it may not have been intended to be used with this rule. To prevent unintended variable references, rules should be defined with the localScope option.

You enable this option by setting the localScope attribute to true in the Rule element:

Example 4–21 Setting localScope Attribute to true in a Rule Element

<Rule name=’generateEmail’ localScope=’true’> 

By setting this option, the rule is only allowed to reference values that were passed explicitly as arguments in the call. When called from the previous workflow action example, the reference to the lastname variable would return null.

Rules intended for general use in a variety of contexts must use the localScope option.