Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   How to generate an alert (http://www.mirthcorp.com/community/forums/showthread.php?t=3115)

jerchap 10-22-2009 08:40 AM

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

albertosaez 10-29-2009 01:06 PM

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


All times are GMT -8. The time now is 08:05 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation