Announcement

Collapse
No announcement yet.

How to generate an alert

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to generate an alert

    I want to generate an alert from within a channel destination so that I can use the alert functionality to email out, rather than make my own emailing mechanism. I can get it to work fine by using throw in a javascript destination, but then the message in the alert contains a bunch of strack trace information. The email is going out to non technical users and they just get confused with all that extraneous information. Is there a way to generate the alert without including all that data?

    As an example, all I want is the alert to say "Error adding child 'abc' to parent 'xyz'" but what actually happens is the error message looks like this:

    ERROR-414: JavaScript Connector error
    ERROR MESSAGE: Error executing script
    org.mozilla.javascript.JavaScriptException: Error adding child 'xyz' to parent 'abc':
    Error invoking WebService AxisFault ca.mycompany.CustomException: class ca.mycompany.item not found: (SearchCode: xyz) (218b5a03-0936-49b7-b65f-74612ee4096d#27)
    at org.mozilla.javascript.gen.c4667._c6(218b5a03-0936-49b7-b65f-74612ee4096d:27)
    at org.mozilla.javascript.gen.c4667.call(218b5a03-0936-49b7-b65f-74612ee4096d)
    at org.mozilla.javascript.optimizer.OptRuntime.callNa me0(OptRuntime.java:106)
    ....
    Last edited by jerchap; 10-22-2009, 08:50 AM.

  • #2
    They are built-in Mirth functions:

    To send an alert:

    alerts.sendAlert('message');

    To send an email:

    var smtpConn = SMTPConnectionFactory.createSMTPConnection();
    smtpConn.send('to', 'cc', 'from', 'subject', 'body');

    Comment

    Working...
    X