Mirth Connect 4.1.0 Released!

Mirth Connect 4.1.0 is now available as an appliance update and on our GitHub page. Mirth Connect 4.1.0 includes new features such as new event log messages, additional fields to the Welcome to Mirth Connect screen, new information included in alerts as well as many smaller changes, updates, and improvements. This release also contains several improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Preprocess Script

  • Filter
  • Time
  • Show
Clear All
new posts

  • Preprocess Script

    I have a channel that will receive different set of messages. It will receive
    ADT - A01, A04, A18

    My issue is that the MSH segment under MSH.9 it only has MSH.9.1 it doesn?t contain the message type. I have performed a replace for the ORM, ORU and ZPD message and it works fine. I tried doing the same thing with the ADT segment by creating an IF Statement, but now the channel doesn?t want to deploy.

    The following is what I have done in the preprocessing script with the ADT events, but it doesn?t work.

    If message.IndexOf("EVN|A04"){
    message = message.replace("|ADT|","|ADT^A04|");
    If message.IndexOf("EVN|A08"){
    message = message.replace("|ADT|","|ADT^A08|");
    If message.IndexOf("EVN|A18"){
    message = message.replace("|ADT|","|ADT^A18|");
    message = message.replace("|ORM|","|ORM^O01|");
    message = message.replace("|ORU|","|ORU^R01|");
    message = message.replace("|ZPD|","|ZPD^ZPD|");

    return message;

    Like I mentioned before, the ORM, ORU and ZPD replace work fine, but once I add the ADT with the If statement it doesn?t work.

    Could someone tell me what I?m doing wrong?



  • #2
    Re:Preprocess Script

    Looks like a syntax problem.

    Check if this sample works for you...

    if (message.IndexOf('EVN|A04')){ 
       message = message.replace('|ADT|','|ADT^A04|');
    Hope it helps!


    • #3
      Re:Preprocess Script

      Thanks, it seems that I had my IF with a capital "I" and JS didn't like it. The channel deployed.