cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

About Add an Alert

ptc-6292098
1-Newbie

About Add an Alert

Hello Adam,

I met a trouble when i tried to create an alert on a property. I found the service "AddOrUpdateAlert" and wrote an example in below.

// test example var table = attributes.alertAttributes; var params = {   alertType: "Above" /* STRING */,  alertName: "h_above" /* STRING /,    property: "humidity" / STRING /,    description: "humidity above threshold value" / STRING /,   attributes: ???? / INFOTABLE /,     priority: 1 / INTEGER /,    persistent: true / BOOLEAN /,   enabled: true / BOOLEAN */ }; me.AddOrUpdateAlert(params);

But there is a parameter that called "attributes" and type is INFOTABLE. I want to know what is mean about this parameter. Can you give me some advice/hint about how to create/modify an alert ? Thank you so much for your always support.

4 REPLIES 4
adam11
5-Regular Member
(To:ptc-6292098)

Hi Hirotaka,

The attributes parameter is where you specify the value or values for the alert. This needs to be documented, but since you provided a code sample for the alert you want to create, I can provide the following snippet which will create an

InfoTable

 that will work for your particular use case.


var alertAttributes = Resources["InfoTableFunctions"].CreateInfoTable();


alertAttributes.AddField();

alertAttributes.AddField();

alertAttributes.AddRow();</div></div></p>

Hi Adam,

I used your snippet and successfully add/update an alert.
Thank you for your help.
Have a good day!

Hi

Actaully I am new thingworx.Can you please share the Alert code, I tried alert but not work

mbereket
3-Visitor
(To:adam11)

Hi Adam,

Do you know how can I do the same thing with REST API calls, imagine a web site using thingworx only with its REST calls, so in my case, I dont know what would replace the snippet you gave.

Anyway, So, What I would like to do is to make a POST request to add an alert and I would like to send the following JSON like Hirotaka:

{alertType: "Above",

alertName: "h_above",

property: "humidity",

description: "humidity above threshold value",

attributes: ????

}

any ideas?

Thanks

Top Tags