ObjectTemplate
Represents an object template definition in a management pack
Warning
This element applies to Management Pack Schema 2.0 only.
Schema Hierarchy
ManagementPack
Templates
ObjectTemplate
Syntax
<ObjectTemplate ID=”TemplateID” Comment=”Comment” TypeID=””>
<Property Path=”PropertyName”>PropertyValue</Property>
<Object Path=”RelationshipID” SeedRole=”Source/Target” TypeConstraint=”ClassTypeID >…</Object>
</ObjectTemplate>
Attributes and Elements
The following sections describe attributes, child elements, and the parent element of the ObjectTemplates element.
Attributes
Attribute | Description |
---|---|
ID |
Required attribute. Represents the identity of the element. To learn how to identify your element in a management pack, see Element Identity and Namespace Conventions. |
Comment |
Optional attribute. Represents commentary by the management pack author. |
TypeID |
Required attribute. The ID of the ClassType or TypeProjection for which this template is implemented. |
Child Elements
Element | Description |
---|---|
Optional element. Represents the property name/value pair for the class type or type projection to which the object template can be applied. |
|
Optional element. Represents a RelationshipType definition in the root class type’s relationship hierarchy of the type projection to which the object template may be applied. Used only when the TypeID element refers to a type projection. |
Parent Elements
Element | Description |
---|---|
Contains each object template that is defined in a management pack. |
Remarks
Object templates define default property values to either instances of type projections or class types. The property values can either be expressed in hard-coded text, or they may refer to an EnumerationValue element defined in either the current or an external management pack.
Because type projections are a collection of class type instances that are related through a common class type hierarchy, object templates also are able to apply default values to any of the class type instances in that relationship hierarchy. For more information on relationship heirarchies and how they are used within type projections, see TypeProjection.
If a template is applied to an object instance of the type specified by TypeID from within the Service Manager console, the property values in the template will override the instance-specific property values of the object instance.
Example
The following XML sample defines an object template for a simple change request. Below the object template is the type projection definition to whose instances this template can be applied.
The Path attribute for the Property element uses Variable Notation to direct the system to the root class type in the relationship hierarchy. For information on how to use $Target/Property, see $Target.
The Path attribute for the Object element uses Variable Notation to direct the system to a specific relationship type in the relationship hierarchy. For information on how to use $Target/Path notation in a type projection definition, see $Target.
<!--Standard Change Request-->
<ObjectTemplate ID="StandardChangeRequest" TypeID="SMChange!System.WorkItem.ChangeRequestProjection">
<Property Path="$Target/Property[Type='WorkItem!System.WorkItem']/Title$">Standard Change Request</Property>
<Property Path="$Target/Property[Type='CoreChange!System.WorkItem.ChangeRequest']/TemplateId$">StandardChangeRequest</Property>
<Property Path="$Target/Property[Type='CoreChange!System.WorkItem.ChangeRequest']/Category$">$MPElement[Name='ChangeCategoryEnum.Standard']$</Property>
<Object Path="$Target/Path[Relationship='CoreActivity!System.WorkItemContainsActivity' SeedRole='Source' TypeConstraint='CoreActivity!System.WorkItem.Activity.ReviewActivity']$">
<Property Path="$Target/Property[Type='WorkItem!System.WorkItem']/Title$">Approve Change Request</Property>
<Property Path="$Target/Property[Type='CoreActivity!System.WorkItem.Activity.ReviewActivity']/ApprovalCondition$">$MPElement[Name='CoreActivity!ApprovalEnum.Unanimous']$</Property>
<Property Path="$Target/Property[Type='CoreActivity!System.WorkItem.Activity']/SequenceId$">0</Property>
</Object>
<Object Path="$Target/Path[Relationship='CoreActivity!System.WorkItemContainsActivity' SeedRole='Source' TypeConstraint='CoreActivity!System.WorkItem.Activity.ManualActivity']$">
<Property Path="$Target/Property[Type='WorkItem!System.WorkItem']/Title$">Apply Change</Property>
<Property Path="$Target/Property[Type='CoreActivity!System.WorkItem.Activity']/SequenceId$">1</Property>
</Object>
</ObjectTemplate>
<TypeProjection ID="System.WorkItem.ChangeRequestProjection" Accessibility="Public" Type="CoreChange!System.WorkItem.ChangeRequest">
<Component Alias="Activity" Path="$Target/Path[Relationship='CoreActivity!System.WorkItemContainsActivity']$">
<Component Alias="ParentWorkItem" Path="$Target/Path[Relationship='CoreActivity!System.WorkItemContainsActivity' SeedRole='Target']$" />
<Component Alias="ActivityCreatedBy" Path="$Target/Path[Relationship='WorkItem!System.WorkItemCreatedByUser']$" />
<Component Alias="ActivityAssignedTo" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" />
<Component Alias="ActivityAboutConfigItem" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAboutConfigItem']$" />
<Component Alias="Reviewer" Path="$Target/Path[Relationship='CoreActivity!System.ReviewActivityHasReviewer']$">
<Component Alias="User" Path="$Target/Path[Relationship='CoreActivity!System.ReviewerIsUser']$" />
<Component Alias="VotedBy" Path="$Target/Path[Relationship='CoreActivity!System.ReviewerVotedByUser']$" />
</Component>
</Component>
<Component Alias="CreatedBy" Path="$Target/Path[Relationship='WorkItem!System.WorkItemCreatedByUser']$" />
<Component Alias="AssignedTo" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" />
<Component Alias="AffectedUser" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAffectedUser']$" />
<Component Alias="RelatedWorkItem" Path="$Target/Path[Relationship='WorkItem!System.WorkItemRelatesToWorkItem']$">
<Component Alias="RelatedWorkItemAssignedTo" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" />
</Component>
<Component Alias="RelatedWorkItemSource" Path="$Target/Path[Relationship='WorkItem!System.WorkItemRelatesToWorkItem' SeedRole='Target']$">
<Component Alias="RelatedWorkItemAssignedTo" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" />
</Component>
<Component Alias="RelatedConfigItem" Path="$Target/Path[Relationship='WorkItem!System.WorkItemRelatesToConfigItem']$" />
<Component Alias="AboutConfigItem" Path="$Target/Path[Relationship='WorkItem!System.WorkItemAboutConfigItem']$" />
<Component Alias="FileAttachment" Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasFileAttachment']$">
<Component Alias="FileAttachmentAddedBy" Path="$Target/Path[Relationship='SupportingItem!System.FileAttachmentAddedByUser']$" />
</Component>
<Component Alias="RelatedKnowledge" Path="$Target/Path[Relationship='CoreKnowledge!System.EntityLinksToKnowledgeDocument']$" />
</TypeProjection>
<TypeProjection ID="System.FileAttachmentProjection" Accessibility="Public" Type="SupportingItem!System.FileAttachment">
<Component Alias="FileAttachmentAddedBy" Path="$Target/Path[Relationship='SupportingItem!System.FileAttachmentAddedByUser']$" />
</TypeProjection>
See Also
Reference
EnumerationValue
Templates
TypeProjection
Other Resources
RelationshipType