Skip to main content
17-Peridot
November 12, 2018
Question

Got an error while creating Alert.

  • November 12, 2018
  • 5 replies
  • 2487 views

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);

 

5 replies

5-Regular Member
November 12, 2018

Hello.

 

The code you pasted in is indeed the same as the example in the Help Center; what does the Script Error Log referenced by the error message say?

 

 

Thanks,

 

-- Craig A.

17-Peridot
November 13, 2018

Yes. I am replicating the same scenario. i am getting an error, Error executing service test. Message :: Alert Type [Above] is not valid - See Script Error Log for more details.

19-Tanzanite
November 13, 2018

Hello all,

 

We are also facing same issue in Thingworx 8.3.0 which is working fine in Thingworx 8.2

 

Regards,

VR

1-Visitor
November 13, 2018

Hi

May Be "MyIntProperty" on your thing either String or some other Base type