Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFNotificationTemplate Class

  • Last UpdatedNov 18, 2025
  • 15 minute read
AFNotificationTemplate Class
The AFNotificationTemplate represents a template of information used to create an AFNotification.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AssetAFElementTemplate
      OSIsoft.AF.NotificationAFNotificationTemplate

Namespace:  OSIsoft.AF.Notification
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

[SerializableAttribute]
public sealed class AFNotificationTemplate : AFElementTemplate, 
	IComparable<AFNotificationTemplate>
<SerializableAttribute>
Public NotInheritable Class AFNotificationTemplate
	Inherits AFElementTemplate
	Implements IComparable(Of AFNotificationTemplate)

Dim instance As AFNotificationTemplate
[SerializableAttribute]
public ref class AFNotificationTemplate sealed : public AFElementTemplate, 
	IComparable<AFNotificationTemplate^>
[<SealedAttribute>]
[<SerializableAttribute>]
type AFNotificationTemplate =  
    class
        inherit AFElementTemplate
        interface IComparable<AFNotificationTemplate>
    end

The AFNotificationTemplate type exposes the following members.

Constructors

  NameDescription
Public method
AFNotificationTemplate
Initializes a new instance of the class with default values.
Public method
AFNotificationTemplate(String)
Initializes a new instance of the class with the specified name.

Properties

  NameDescription
Public property
AllowElementToExtend
This read/write property determines if additional attributes or ports can be added to instances of AFBaseElement objects.
(Inherited from AFElementTemplate.)
Public property
AnalysisTemplate
The AFAnalysisTemplate used to create the AFAnalysis for the AFNotification created from this template.
Public property
AnalysisTemplates
This is a collection of analysis templates that target this element template.
(Inherited from AFElementTemplate.)
Public property
AttributeTemplates
Gets the collection of AFAttributeTemplate objects that are owned by this template.
(Inherited from AFElementTemplate.)
Public property
AutoCreate
This property specifies the option for automatically creating an AFNotification for an AFElement.
Public property
BaseTemplate
This property returns the AFElementTemplate which this template inherits from.
(Inherited from AFElementTemplate.)
Public property
BaseTemplateOnly
This read/write property determines if instances of this AFBaseElement object are allowed to be created. This is typically a BaseTemplate that contains some core functionality for other derived templates.
(Inherited from AFElementTemplate.)
Public property
CanBeAcknowledged
This property is the default value for the CanBeAcknowledged property of any new AFEventFrame created from this template.
(Inherited from AFElementTemplate.)
Public property
Categories
This is a user-defined collection of categories for the object that can be used for querying and/or reporting purposes.
(Inherited from AFElementTemplate.)
Public property
CategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
(Inherited from AFElementTemplate.)
Public property
ChangeOnly
A flag to indicate that only change notifications should be sent for the notification created from this template.
Public property
CheckOutInfo
This read-only property returns the checked out status information for the object.
(Inherited from AFElementTemplate.)
Public property
ChildReferenceTypes
This is a read-only collection of all AFReferenceType objects that can be used to create a child reference to an AFElement created from this template.
(Inherited from AFElementTemplate.)
Public property
Contents
The collection of contents used to create the AFNotificationContents for the AFNotification created from this template.
Public property
Database
This read-only property returns the AFDatabase where this object is defined.
(Inherited from AFElementTemplate.)
Public property
DefaultAttribute
The AFAttributeTemplate associated with the default AFAttribute for the AFBaseElement created from this template.
(Inherited from AFElementTemplate.)
Public property
DefaultInputPort
The default input AFPort for the AFBaseElement created from this template.
(Inherited from AFElementTemplate.)
Public property
DefaultOutputPort
The default output AFPort for the AFBaseElement created from this template.
(Inherited from AFElementTemplate.)
Public property
DefaultUndirectedPort
The default undirected AFPort for the AFBaseElement created from this template.
(Inherited from AFElementTemplate.)
Public property
Description
Read/write property that provides a more detailed description of the object.
(Inherited from AFElementTemplate.)
Public property
ExpirationPeriod
Expiration period for the notification created from this template.
Public property
ExtendedProperties
A dictionary of extended properties that can be used to store application specific information.
(Inherited from AFElementTemplate.)
Public property
FallingBehindOption
Falling behind option for the notification created from this template.
Public property
HasAnalyses
This read-only property returns if there are any AFAnalysisTemplate objects that target this element template.
(Inherited from AFElementTemplate.)
Public property
HasNotifications
This read-only property returns if there are any AFNotificationTemplate objects that target this element template.
(Inherited from AFElementTemplate.)
Public property
ID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
InstanceType
Specifies the System.Type used when creating AFBaseElement objects from this template.
(Inherited from AFElementTemplate.)
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
IsDirty
This read-only property indicates whether the object has been modified since the last save to the PI AF Server.
(Inherited from AFElementTemplate.)
Public property
IsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
(Inherited from AFElementTemplate.)
Public property
MinimumAcknowledgements
The minimum number of acknowledgments for the notification created from this template.
Public property
Name
Read/write property that identifies the name of the object.
(Inherited from AFElementTemplate.)
Public property
NamingPattern
The naming pattern used when creating elements from this template.
(Inherited from AFElementTemplate.)
Public property
NonrepetitionInterval
Non-repetition interval for the notification created from this template.
Public property
NotificationContacts
The collection of AFNotificationContact objects used to create the AFNotificationContacts for the AFNotification created from this template.
Public property
NotificationRuleTemplates
This is a collection of AFNotificationRuleTemplate objects that target this element template.
(Inherited from AFElementTemplate.)
Public property
ParentReferenceTypes
This is a read-only collection of all AFReferenceType objects that can be used to create a parent reference to an AFElement created from this template.
(Inherited from AFElementTemplate.)
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
Ports
This is a collection of AFPort objects representing the possible connection ports for elements created from this template. Ports are used in a AFModel to define an AFConnection between AFBaseElement object.
(Inherited from AFElementTemplate.)
Public property
Priority
The priority of the AFNotification created from this template.
Public property
ResendInterval
The interval for resending the notification created from this template.
Public property
Security
This read-only property returns the AFSecurity information for the object.
(Inherited from AFElementTemplate.)
Public property
Severity
This property is the default value for the Severity property of any new AFEventFrame created from this template.
(Inherited from AFElementTemplate.)
Public property
Target
The target of the AFAnalysisTemplate associated with this notification template.
Public property
Type
This property specifies the base type of the element created from this template.
(Inherited from AFElementTemplate.)
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)

Methods

  NameDescription
Public methodCode example
ApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
(Inherited from AFElementTemplate.)
Public methodCode example
CheckIn
This method checks in (commits) all the changes to the object by saving the information to persistent storage.
(Inherited from AFElementTemplate.)
Public method
CheckOut
This method locks the object so that its configuration can be modified.
(Inherited from AFElementTemplate.)
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public method
CreateDefaultPorts
This method can be used to create the default connection ports based upon the element's type.
(Inherited from AFElementTemplate.)
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public method
FindContact
Used for finding the AFNotificationContact with a given ID for the notification contact or its template.
Public method
FindDerivedTemplates
This method returns the collection of AFElementTemplate objects that have this template as their base template.
(Inherited from AFElementTemplate.)
Public method
FindInstantiatedElements(Boolean, AFSortField, AFSortOrder, Int32)
This method returns a non-paged collection of AFBaseElement objects that were created with this template.
(Inherited from AFElementTemplate.)
Public method
FindInstantiatedElements(Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)
This method returns a paged collection of AFBaseElement objects that were created with this template.
(Inherited from AFElementTemplate.)
Public methodStatic member
FindNotificationTemplate(PISystem, Guid)
Retrieves the AFNotificationTemplate object with the specified unique identifier at the AFTime.MaxValue query date.
Public methodStatic member
FindNotificationTemplate(PISystem, Guid, Object)
Retrieves the AFNotificationTemplate object with the specified unique identifier at the specified query date.
Public method
GetAllAnalysisTemplates
Gets the list of analysis templates for this template and all base templates.
(Inherited from AFElementTemplate.)
Public method
GetAllAttributeTemplates
Gets the list of top-level attribute templates for this template and all base templates.
(Inherited from AFElementTemplate.)
Public method
GetAllCategories
Gets the list of categories for this template and all base templates.
(Inherited from AFElementTemplate.)
Public method
GetAllCategoriesString
Gets the list of categories for this template and all base templates.
(Inherited from AFElementTemplate.)
Public method
GetAllNotificationRuleTemplates
Gets the list of AFNotificationRuleTemplate objects for this template and all base templates.
(Inherited from AFElementTemplate.)
Public method
GetAllPorts
Gets the list of ports for this template and all base templates.
(Inherited from AFElementTemplate.)
Public method
GetAttributeTemplateByTrait
Retrieves the child AFAttributeTemplate with the specified AFAttributeTrait.
(Inherited from AFElementTemplate.)
Public method
GetAttributeTemplatesByTrait
Retrieves a list of child AFAttributeTemplate objects identified by the specified list of attribute traits.
(Inherited from AFElementTemplate.)
Public method
GetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
GetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public method
GetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
(Inherited from AFElementTemplate.)
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
IsTypeOf
Checks if the current AFElementTemplate is derived from the specified base element template.
(Inherited from AFElementTemplate.)
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
Refresh
Refreshes the client with any changes that have been made to the object since loaded.
(Inherited from AFElementTemplate.)
Public method
ToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public method
UndoCheckOut
This method discards all the changes to the object and all sub-objects since the last call to CheckOut. Any changes since the check out will be lost.
(Inherited from AFElementTemplate.)

Events

  NameDescription
Public eventCode example
Changed
Event is raised when the object or one of its sub-objects is changed.
(Inherited from AFElementTemplate.)

Remarks

This type of template is used to create an AFNotification and define its additional fields that are not present in an AFBaseElement. The AFElementTemplate is used to create the other types of AFBaseElement objects.

In addition to the fields and collections defined by the AFElementTemplate for the created AFNotification, this template also defines several additional fields specific to a notification (i.e. Priority, ResendInterval, etc.). It also specifies an NotificationContacts collection to be used to create the AFNotificationContact collection and the AFAnalysisTemplate to be used to create an AFAnalysis for the new notification. A collection of Contents is also defined by the template.

Use one of the AFNotifications.Add Overload methods to create a new AFNotification object. Use the PISystem.Supports method to check if the PISystem supports the NotificationTemplate feature.

Examples

// This example demonstrates how to create a notification template that
// uses an analysis template, create a notification from the template,
// and displays its information.

// Get the Database
PISystems myPISystems = new PISystems();
AFDatabase myDB = myPISystems.DefaultPISystem.Databases.DefaultDatabase;

// Create an Element Template, an Analysis Template, and target Element
AFElementTemplate myElemTemplate = myDB.ElementTemplates.Add("MyTargetTemplate");
AFAnalysisTemplate myAnalysisTemplate = myDB.AnalysisTemplates.Add("MyAnalysis");
myAnalysisTemplate.Target = myElemTemplate;
AFElement myTargetElement = myDB.Elements.Add("MyTarget", myElemTemplate);

// Create a Notification Template configured to AutoCreate its Target
AFNotificationTemplate myNotificationTemplate = new AFNotificationTemplate("MyNotificationTemplate");
myNotificationTemplate.Description = "Template used to create my notifications";
myNotificationTemplate.AnalysisTemplate = myAnalysisTemplate;
myNotificationTemplate.AutoCreate = AFNotificationTemplate.AutoCreateOption.AutoCreate;
myDB.ElementTemplates.Add(myNotificationTemplate);

// Create a Notification from the Notification Template
AFNotification myNotification = new AFNotification(myDB, "MyNotification", myNotificationTemplate, myTargetElement);
myDB.CheckIn();

// Display the name and description of the Notification Template
Console.WriteLine("Name of Notification Template = {0}", myNotificationTemplate.Name);
Console.WriteLine("Description = {0}", myNotificationTemplate.Description);
Console.WriteLine("UniqueID of Notification Template = {0}", myNotificationTemplate.UniqueID);

// Display the name of all Notifications created from this Notification Template
const int pageSize = 100;
int startIndex = 0;
int totalCount;
do
{
    AFNamedCollectionList<AFBaseElement> list =
        myNotificationTemplate.FindInstantiatedElements(true,
            AFSortField.Name, AFSortOrder.Ascending, startIndex, pageSize, out totalCount);
    foreach (AFBaseElement CurNotification in list)
    {
        Console.WriteLine("Name of Notification created from this template = {0}", CurNotification.Name);
    }
    startIndex = (startIndex + pageSize);    // Advance to next page
} while (startIndex < totalCount);

// Display the names of the auto-created objects
Console.WriteLine("Name of Notification's Analysis = {0}", myNotification.Analysis.Name);
AFElement target = myNotification.Analysis.Target as AFElement;
Console.WriteLine("Name of Analysis Target = {0}", target.Name);
' This example demonstrates how to create a notification template that
' uses an analysis template, create a notification from the template,
' and displays its information.

' Get the Database
Dim myPISystems As New PISystems
Dim myDB As AFDatabase = myPISystems.DefaultPISystem.Databases.DefaultDatabase

' Create an Element Template, an Analysis Template, and target Element
Dim myElemTemplate As AFElementTemplate = myDB.ElementTemplates.Add("MyTargetTemplate")
Dim myAnalysisTemplate As AFAnalysisTemplate = myDB.AnalysisTemplates.Add("MyAnalysis")
myAnalysisTemplate.Target = myElemTemplate
Dim myTargetElement As AFElement = myDB.Elements.Add("MyTarget", myElemTemplate)

' Create a Notification Template configured to AutoCreate its Target
Dim myNotificationTemplate As AFNotificationTemplate = New AFNotificationTemplate("MyNotificationTemplate")
myNotificationTemplate.Description = "Template used to create my notifications"
myNotificationTemplate.AnalysisTemplate = myAnalysisTemplate
myNotificationTemplate.AutoCreate = AFNotificationTemplate.AutoCreateOption.AutoCreate
myDB.ElementTemplates.Add(myNotificationTemplate)

' Create a Notification from the Notification Template
Dim myNotification As AFNotification = New AFNotification(myDB, "MyNotification", myNotificationTemplate, myTargetElement)
myDB.CheckIn()

' Display the name and description of the Notification Template
Console.WriteLine("Name of Notification Template = {0}", myNotificationTemplate.Name)
Console.WriteLine("Description = {0}", myNotificationTemplate.Description)
Console.WriteLine("UniqueID = {0}", myNotificationTemplate.UniqueID)

' Display the name of all Notifications created from this Notification Template
Dim pageSize As Integer = 100
Dim startIndex As Integer = 0
Dim totalCount As Integer
Dim list As AFNamedCollectionList(Of AFBaseElement)
Do
    list = myNotificationTemplate.FindInstantiatedElements(True, AFSortField.Name, AFSortOrder.Descending, startIndex, pageSize, totalCount)
    Dim CurNotification As AFBaseElement
    For Each CurNotification In list
        Console.WriteLine("Name of Notification created from this template = {0}", CurNotification.Name)
    Next CurNotification

    startIndex = (startIndex + pageSize)    ' Advance to next page
Loop While (startIndex < totalCount)

' Display the names of the auto-created objects
Console.WriteLine("Name of Notification's Analysis = {0}", myNotification.Analysis.Name)
Dim target As AFElement = CType(myNotification.Analysis.Target, AFElement)
Console.WriteLine("Name of Analysis Target = {0}", target.Name)

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

Version Information

AFSDK


See Also

TitleResults for “How to create a CRG?”Also Available in