How to edit/update an alert limits from a Service.
Hi All,
I want to update the limits of an alert by triggering a service. How can I achieve that?
From Thingworx Support, I got the following code which I have pasted below. I tried running that but it doesnot work.
For example: I have a property "Suction" with basetype as "INTEGER". I have already created an alert for that named "AboveLimit" which will be fired when Suction is above limit 5. Now I want to change the limit through a service. I wrote the following but its not working.
// 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 = 10; // Alert will trigger when field >=10
row.limitInclusive = true; // Alert includes 10
attrs.AddRow(row);
// Call the AddOrUpdateAlert Service
var params = {
alertType: "Above" /* STRING */,
alertName: "AboveLimit" /* STRING */,
property: "Suction" /* STRING */,
attributes: attrs /* INFOTABLE */,
priority: 1 /* INTEGER */,
persistent: true /* BOOLEAN */,
enabled: true /* BOOLEAN */
};
me.AddOrUpdateAlert(params);
Please help to achieve the following!!!
Thanks in advance.

