web stats
Send an Email alert When a Message get Filtered at Source Filter - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 05-24-2018, 11:47 PM
Parvinder Parvinder is offline
What's HL7?
Join Date: May 2018
Location: New Delhi, India
Posts: 1
Parvinder is on a distinguished road
Arrow Send an Email alert When a Message get Filtered at Source Filter

Hi Folks,

I am trying to send an alert on email when the message gets filtered.
For now, I typed an if statement which actually Filters out the message. But don't send any alert at all.

if((msg['PID']['PID.14']['PID.14.1'].toString() != "")
return true;
return false;

In this case, it will filter out the message. But will not send any alert. In the example given below. I can throw an exception and generate an alert but in this case, my message will no more be in the mirth filter and will to the error filter.

if((msg['PID']['PID.14']['PID.14.1'].toString() != "")
return true;
throw "Exception"

So what Should I do alert an email, When a message gets Filtered in the Filter?
Reply With Quote
Old 05-25-2018, 07:34 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road

You can do this:

alerts.sendAlert('your custom message');
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

- How do I foo?
- You just bar.
Reply With Quote
Old 05-25-2018, 02:23 PM
stormcel stormcel is offline
OBX.3 Kenobi
Join Date: Mar 2010
Location: Phoenix
Posts: 150
stormcel is on a distinguished road

var currMessageid = connectorMessage.getMessageId();
var curServerName = 'put the name of your server here';
var emailTo = 'put your email address here';
var emailCc = 'put another email address here for cc';
var emailFrom = 'put the sending email address i.e. mirth@mymail.com';
var emailSubj = ' Missing Business Phone Number- Channel: ' + ChannelUtil.getDeployedChannelName(channelId) + ' On server: ' + curServerName;
var emailBody = 'A business phone number was not present.t\r\n';
emailBody = emailBody + 'In Message Number: *' + currMessageid + '*\t\r\n';
emailBody = emailBody + 'Due to an empty PID.14.1\t\r\n';
emailBody = emailBody + 'On ' + curServerName + '. \t\r\n';
emailBody = emailBody + 'Thank You';
var smtpConn = SMTPConnectionFactory.createSMTPConnection();
Reply With Quote

mirth filter, send an email alert

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 08:53 AM.

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