14 Replies Latest reply on Jun 30, 2016 8:13 AM by pchung RSS
    petersch Apprentice

    Generating an Alert from a subscription/service - getting 'unable to publish local event'

    Rather than generating an alert based on a threshold value I set via the 'Managed Alerts' UI of Composer I want to generate an alert from a subscription or service that I run. I found what appears to be the right service in the snippets, e.g. I have a service that uses the Alerts() service like this:


    var params = {

    alertType: "EqualTo" /* STRING */,

    sourceProperty: "myProperty" /* STRING */,

    name: "MyAlert" /* STRING */,

    description: "description for MyAlert" /* STRING */,

    priority: 3 /* INTEGER */,

    message: "Message for MyAlert" /* STRING */

    };

     

    me.Alert(params);

     

    I have also defined 'MyAlert' via the Managed Alerts' UI of the Composer for 'myProperty'. But when I run the above service it generates no alert. I get a pair of Warning that say 'Unable to publish local event in testThing : Event Alert not found' and 'Unable to publish event in testThing : Event Alert not found'.

     

    How does one use the Alert() service to create a new alert on a property as part of service or subscription javascript?