Skip to main content



Notification

Represents a notification fired by the runtime engine from a Fire Notification action.

getName()

Returns: string

Description: Name of the Notification

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){
var notifications = session.getActiveNotifications();
for(var i=0;i < notifications.length; i++){
console.log(notifications[i].getName());
}
});

isActive

Returns: bool

Description: Boolean that identifies whether or not this Notification instance is active

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){
var notifications = session.getActiveNotifications();
for(var i=0;i < notifications.length; i++){
console.log(notifications[i].isActive);
}
});

type

Returns: string

Description: The type of Notification. Possible values: 'Informational', 'Warn', 'Error'.

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){
var notifications = session.getActiveNotifications();
for(var i=0;i < notifications.length; i++){
console.log(notifications[i].type);
}
});

associatedField

Returns: string

Description: The element ID of the field associated to this Notification instance

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){
var notifications = session.getActiveNotifications();
for(var i=0;i < notifications.length; i++){
console.log(notifications[i].associatedField);
}
});

message

Returns: string

Description: The message for this Notification instance

Code Sample:

var session = inrule.createRuleSession(); 
session.createEntity("Entity1");
session.applyRules(function(log){
var notifications = session.getActiveNotifications();
for(var i=0;i < notifications.length; i++){
console.log(notifications[i].message);
}
});