web stats
Destination Set Filter Sending Messages to Wrong Destination, Bug? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2020, 02:52 PM
GrnMtnBuckeye GrnMtnBuckeye is offline
What's HL7?
 
Join Date: Jan 2016
Posts: 4
GrnMtnBuckeye is on a distinguished road
Default Destination Set Filter Sending Messages to Wrong Destination, Bug?

Using Mirth Connect Server 3.8.1, Java Version 1.8.0_181, we just set up a new destination set filter for EDI X12 messages with the following javascript Source Transformer:

switch (msg['GS']['GS.03']['GS.03.1'].toString()) {
case 'ACME':
destinationSet.removeAllExcept('Destination_ACME') ;
break;
case 'ARMS':
destinationSet.removeAllExcept('Destination_ARMS') ;
break;
default:
destinationSet.removeAllExcept('Destination_Unknow n');
break;
}

The ACME customer had the correct destination configured in mirth, The ARMS customer didn't actually have a destination by the name of 'Destination_ARMS' configured in mirth, 'Destination_Unknown' was configured as a file writer destination (in case someone sends a message to the source for a new customer without notifying my team that we need to set up a new destination).

When we did our testing, we found that records with 'ARMS" in GS.03 were being routed to Destination_ACME AND Destination_Unknown. This appears to be caused by the fact that the Destination Set Filter was set for GS.03 value of ARMS to route to a destination that didn't yet exist. I would expect that this situation would cause an error instead of sending potentially sensitive information to the wrong customer. Is this a bug or is there something different we should have done in our javascript? If it is a bug, please point me to the proper steps to log it. Thanks in advance!

Last edited by GrnMtnBuckeye; Today at 02:30 PM. Reason: errant space in a word
Reply With Quote
  #2  
Old Today, 02:29 PM
GrnMtnBuckeye GrnMtnBuckeye is offline
What's HL7?
 
Join Date: Jan 2016
Posts: 4
GrnMtnBuckeye is on a distinguished road
Default Bug Confirmed - Workaround: Use Destination IDs Instead

I posted a similar question in the Mirth Slack Channel and was told that this is indeed a known bug with the Destination Set Filter. The default behavior of a channel is to send to all destinations. If the Destination Set Filter code fails to "resolve" the destination name to an ID for the string you are passing, it will fail and therefore do nothing (filter nothing and revert to default behavior of sending to all destinations).

@agermano suggested that I could pass an array to the filter instead of the string but I am a Javascript noob and none of my array attempts were successful so I used the Destination ID instead of Destination string. Even using a Destination ID that is inactive will work fine, without sending to all the other destinations. This isn't ideal because it makes the channel less portable from one environment to the next (have to double check Destination IDs when you import channel), but it meets my intent so I'm calling it a viable workaround at least.

New Code ('Destination_ACME' has ID of 2, 'Destination_ARMS' has ID of 4, and 'Destination_Unknown' has ID of 3):

switch (msg['GS']['GS.03']['GS.03.1'].toString()) {
case 'ACME':
destinationSet.removeAllExcept(2) ;
break;
case 'ARMS':
destinationSet.removeAllExcept(4) ;
break;
default:
destinationSet.removeAllExcept(3);
break;
}
Reply With Quote
Reply

Tags
#destinationset, #edi, #filter, #javascript, #x12

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 04:23 PM.


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