Previous Topic: Rule SubstringsNext Topic: Explicit Global User Attribute Rules


Multivalued Rule Expressions

Most rule expressions are single-valued. They start from one user attribute value (possibly empty) and result in one account attribute value (also possibly empty). However, sometimes you want to consider an empty user attribute as 0 values. Sometimes you may want to generate multiple values to populate a multivalued account attribute value.

The following rule syntax lets you work with zero or more values that a user attribute may contain:

%*var%

The optional multivalued flag asterisk (*) immediately after the first percent sign % of a rule expression indicates that the result of this rule expression should be 0, 1 or more than 1 value depending on how many values the referenced user attribute contains.

Most user attribute values are single-valued, so they may only contain 0 or 1 values. However, the custom attributes (CustomField01 through CustomField99) are multivalued attributes, so a rule variable referencing these attributes may contain 0, 1, or more than 1 value.

If a user attribute has more than 1 value, but you fail to include the asterisk (*) in your rule expression, then the result of the rule evaluation will be that of the first value. However, in most cases attribute values are officially unordered and as a result the value that CA Identity Manager considers first may not be predictable.

If a user attribute has more than one value, and you include the * in your rule expression, multiple values are generated for the account attribute. Do not define such a multivalued rule expression in an account template if the account attribute being set from that account template attribute is not itself multivalued.

You can define an extended account attribute in the ADS endpoint type to be multivalued; and use this multivalued rule expression syntax to set that attribute. For example, consider an environment that defines an extended ADS account attribute named patents and custom user attribute number three also named patents.

An ADS account template could define, for the patents attribute, the rule string %*UCU03%. Then, you could change a user's patents attribute by adding one or more values. When applying the changes to the user, select the option of updating the user's accounts. This consults the account's account template, finds the rule variable %*UCU03%, and knows to copy all of the user's patents to the account's patents attribute.

Similarly, during account creation, rule strings are evaluated. Furthermore, during account template change, if the rule string has been changed, you can choose to recompute the rule for all accounts associated to the account template.

The %*var% syntax is also meaningful for variables var that refer to single-valued user attributes. This is true only when concatenation is involved and if the referenced attributes are unset on users.

The optional multivalued flag asterisk (*) indicates that the rule containing a %*var% rule variable evaluates to no value if the user attribute has no values. This is different from the single-valued rule expression %var%, which always evaluates to a single value, even if it is an empty string.

To understand this difference, consider the following rule strings:

(310)%UP%
 (310)%*UP%

Both rule strings appear to append area code 310 to the telephone number. However, they are different because if users have no value for their telephone number, the first rule evaluates to the account value of (310). The second rule string generates no value and leaves the account attribute unset.

On the other hand, consider the following rule strings that appear to append the telephone extension to the telephone number:

%UP% %UPE%
%UP% %*UPE%

If everyone has a telephone number, but some do not have extensions, the first rule string generates a value that includes the phone number for each user with no extension. The second rule string generates no values. In this case, use the first rule with %UPE%.