Question
Got an error while creating Alert.
Hi All,
I am trying to add alert to the property with a service.
Got an error like Error executing service test. Message :: Alert Type [Above] is not valid - See Script Error Log for more details. How to resolve this issue?
I followed same code mentioned here.
// Create the Attributes Infotable for AddOrUpdateAlert call
var params = {
infoTableName: "alertAttr" /* STRING */
};
var attrs = Resources["InfoTableFunctions"].CreateInfoTable(params);
// Define the fields required by an Above type Alert for an INTEGER field (not the values!)
// limit - Minimum value at which the alert will trigger.
var field = new Object();
field.name = "limit";
field.baseType = 'INTEGER';
attrs.AddField(field);
// limitInclusive - Is the condition Greater than (>) or Greater than or equal (>=)?
field.name = "limitInclusive";
field.baseType = 'BOOLEAN';
attrs.AddField(field);
// Define the new Alert values and add the row to the table.
var row = new Object();
row.limit = 5; // Alert will trigger when field >=5
row.limitInclusive = true; // Alert includes 5
attrs.AddRow(row);
// Call the AddOrUpdateAlert Service
var params = {
alertType: "Above" /* STRING */,
alertName: "MyAlert" /* STRING */,
property: "MyIntProperty" /* STRING */,
attributes: attrs /* INFOTABLE */,
priority: 1 /* INTEGER */,
persistent: true /* BOOLEAN */,
enabled: true /* BOOLEAN */
};
me.AddOrUpdateAlert(params);

