# create-rule

Deprecated as of DirXML 2.0 - use DirXMLScript <rule>.

<create-rule> is used to specify the criteria for creating a new object as a result of an <add> event.

When a <create-rule> is evaluated, it first checks whether or not this is a suitable rule for the <add> event in question. It does this by checking if a class-name is specified by the rule. If so then the rule is only suitable if the class-name matches the class-name on the event. It then checks if any <match-attr> criteria is specified by the rule. If so, the rule is only suitable if the <add> contains all the attribute values required by the <match-attr>. If a rule is determined to not be suitable it is skipped.

Once a suitable rule is found, the <add> is evaluated to see if it has a value for all of the <required-attr> that do not contain a default value. If not, the <add> is vetoed, otherwise it is allowed. Then any required attributes with default values that were missing from the <add> are filled in. The if the write-back attribute of the <required-attr> element is set the missing values are also written back to the source object. The template-dn attribute is filled in if a <template> is specified.

Example

See <create-rules>

## 1. Allowed Content

> match-attr
>   Match an attribute. Deprecated as of DirXML 2.0.
> required-attr
>   Required attribute. Deprecated as of DirXML 2.0.
> template
>   Specify a template. Deprecated as of DirXML 2.0.

## 2. Attributes

> Attribute | Value(s) | Default Value
> --- | --- | ---
> class-name | CDATA The name of the base class of the objects this rule applies to in the eDirectory namespace. If empty or not present, then this rule applies to all base classes. | #IMPLIED
> description | CDATA Description of this rule, primarily for use in ConsoleOne. | #IMPLIED

## 3. Content Rule

> ( match-attr * , required-attr * , template ? )

## 4. Parent Elements

> create-rules
>   Top level element for object creation rules. Deprecated as of DirXML 2.0.

Top Elements || All Elements || Tree