Other Tips
Do not reference Mirth Connect internal Java classes in your JavaScript code.
Do not reference Mirth Connect internal Java classes in your JavaScript code.
Recommendations
Explore
Mirth® Connect by NextGen Healthcare User Guide
Do not reference Mirth® Connect internal Java classes in your JavaScript code.
These classes are not intended to be used directly by your channels and could result in unexpected behavior. They are also subject to change, so upgrading to a new version of Mirth® Connect could immediately break your channels. Instead, make use of the user API. There is a link to browse the user API documentation in the left-hand navigation menu: Any methods/functions in the user API are intended to be used by channels and are guaranteed to be supported and available when you upgrade Mirth® Connect. Future versions of Mirth® Connect may deprecate certain functions, in which case a warning message will appear in your server log. Parent topic: Other Tips
Mirth® Connect by NextGen Healthcare User Guide
Channel Configuration
Use tags to categorize your channels Place any reusable JavaScript code into Code Template functions and organize them into Code Template Libraries. Use Custom Meta Data Columns to increase the performance of searching the message history on a particular message field. Use Deploy/Start Dependencies if one channel depends on another to operate correctly. Use multiple resource folders for your Java libraries if you need to limit library usage to specific channels or if you have many Java libraries. Use tags to categorize your channels Place any reusable JavaScript code into Code Template functions and organize them into Code Template Libraries. Use Custom Meta Data Columns to increase the performance of searching the message history on a particular message field. Use Deploy/Start Dependencies if one channel depends on another to operate correctly. Use multiple resource folders for your Java libraries if you need to limit library usage to specific channels or if you have many Java librari
Mirth® Connect by NextGen Healthcare User Guide
Using Java Classes
You can access any Java class in any JavaScript context: var map = new Packages.java.util.LinkedHashMap(); The "Packages." at the beginning may be omitted for common top-level package domains, like "com", "net", "org", and "java". To avoid having to type out the fully-qualified class name every time, you can import the package: importPackage(org.apache.commons.io);FileUtils.getUserDirectory(); For classes in custom or non-standard libraries, create a resource (see Resources Settings Tab) containing your .jar file. Then include it on the channel in the Library Resources dependencies tab. Parent topic: Using JavaScript in Mirth Connect
Mirth® Connect by NextGen Healthcare User Guide
Mirth® Connect and JavaScript
JavaScript is a scripting language that can be used in a wide variety of places throughout Mirth® Connect to perform advanced routing and transformation. About JavaScript Using JavaScript in Mirth Connect Using the JavaScript Editor Variable Maps Attachment JavaScript Functions The User API (Javadoc) The user API (application programming interface) is a collection of Java classes and methods that helps you interact with channels and the message that is being processed. Mirth Connect Debugger
Mirth® Connect by NextGen Healthcare User Guide
Using JavaScript in Mirth® Connect
This section shows you how to use JavaScript to perform various messaging operations within Mirth® Connect. About E4X Accessing Message Data with E4X Adding Segments to a Message Segments are a group of fields that can contain varying types of data. Each segment exists independently and can be used in multiple messages. Deleting a Segment Iterating Over Message Segments Iterating Over Repeating Fields Adding a New Repeating Field Message Variables Built-In Code Templates Using Java Classes Regular Expressions Logging with JavaScript Generating a Hash with JavaScript How to generate a hash using Javascript. Parent topic: Mirth Connect and JavaScript
Mirth® Connect by NextGen Healthcare User Guide
About JavaScript
This section provides a basic explanation of how the language works: Variables Comments Arrays Operators Conditional Statements Loops and Iterations Exception Handling Variables Comments Arrays Operators Conditional Statements Functions Loops and Iterations Exception Handling Parent topic: Mirth Connect and JavaScript