Skip to main content
1-Visitor
Aug 14, 2014 7:03 AM UTC
Question

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

    5-Regular Member
    Aug 18, 2014 7:39 PM UTC

    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>

    Translate
    1-Visitor
    Aug 18, 2014 11:37 PM UTC

    Hi Adam,

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

    Translate
    1-Visitor
    Jun 27, 2016 2:15 PM UTC

    Hi

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

    Translate