Inputs
The designer shows the main inputs (output format, validate, generate ACK, ACK mode); the rest are under Advanced parameters.
| Input | Default | Meaning |
|---|---|---|
message | (required) | ER7 payload: a single message, several messages, or an FHS/BHS batch. MLLP framing and CR, LF or CRLF are accepted. |
validateXml | true | Validate the XML against the XSD (errors → AE). |
generateAck | true | Build the ACK/NAK. |
ackMode | Auto | Auto (enhanced CA/CE/CR when MSH-15/16 are present, honouring AL/NE/ER/SU), Original, Enhanced. |
outputFormat | xml | json returns the same document as JSON (JSON instead of XML). |
schemaName | empty | Empty = automatic (how schemas are chosen). Otherwise a root name, file.xsd or file.xsd#ROOT. |
allowSchemaless | false | No schema found → generic XML (PID_3, PID_3_3 names, no groups) instead of AR / 200. |
allowUndefinedZSegments | true | Keep Z-segments the XSD doesn't define (warning; left out of validation). false = error. |
allowUndefinedContent | true | Keep HL7 extensions (see behaviour). false = errors (AE). |
supportedVersions | empty | For example 2.5.1,2.4: other MSH-12 versions → AR / 203. |
ackSendingApplication, ackSendingFacility | MSH-5, MSH-6 | MSH-3 / MSH-4 of the ACK. |
wrapAckInMllp | false | Add MLLP framing to the ACK. |
indent | false | Pretty-print the XML or JSON. |
schemaFolder | connection, else Artifacts/Schemas | Folder with the XSDs. |
Output
Outputs are in the action's body, in camelCase. body('Decode_HL7') is this object (run history shows it under body, next to statusCode):
body('Decode_HL7')
├─ success true when every message decoded without errors (warnings allowed)
├─ isBatch, messageCount
├─ ackCode the FIRST message's
├─ xml the FIRST message's document, as a string (outputFormat xml)
├─ json the same document as JSON text (outputFormat json); the other one is null
├─ outputFormat "xml" or "json"
├─ ack the FIRST message's ACK (ER7)
├─ batchAck FHS/BHS … BTS/FTS around every message's ACK, for a batch
├─ messages[] one entry per message, in input order:
│ success, ackCode, messageType, triggerEvent, messageStructure, version, controlId,
│ sendingApplication, sendingFacility, receivingApplication, receivingFacility, processingId,
│ schema, xml, json, ack, errors[]
└─ errors[] every message's errors: code, codeText, severity, message, location, controlIdxmlandjsonare strings, not objects. Read them withxml(body('Decode_HL7')?['xml'])andxpath(), or withjson(body('Decode_HL7')?['json']). See Maps and XPath.- MSH is in the document, and its main values are also copied into each
messages[i].body('Decode_HL7')?['messages']?[0]?['controlId']is MSH-10 without any XPath. - The top-level
xml,json,ackandackCodeare the first message's. For a batch or several messages, loop overmessages. Each entry has its own document, ACK and errors.successcovers all of them. - The input isn't repeated in the outputs. It is in the action's inputs in run history.
A message whose PID-8 is X, a value the schema's table doesn't allow:
{
"success": false,
"isBatch": false,
"messageCount": 1,
"ackCode": "AE",
"xml": "<ns0:ADT_A01_25 xmlns:ns0=\"http://lambogenius.com/HealthCare/HL7/2X\"><MSH>…</ns0:ADT_A01_25>",
"json": null,
"outputFormat": "xml",
"ack": "MSH|^~\\&|TARGET|FACILITY|HOSPITAL|FACILITY|20261021182459-0400||ACK^A01^ACK|20261021222459365359|T|2.5\rMSA|AE|MSG00003|XSD validation: …\rERR||PID^3^8^1|102^Data type error^HL70357|E||||XSD validation: …\r",
"batchAck": null,
"messages": [ {
"success": false, "ackCode": "AE",
"messageType": "ADT", "triggerEvent": "A01", "messageStructure": "ADT_A01", "version": "2.5", "controlId": "MSG00003",
"sendingApplication": "HOSPITAL", "sendingFacility": "FACILITY", "receivingApplication": "TARGET", "receivingFacility": "FACILITY",
"processingId": "T", "schema": "ADT_A01_25.xsd#ADT_A01_25",
"xml": "<ns0:ADT_A01_25 …", "json": null, "ack": "MSH|^~\\&|TARGET|…", "errors": [ … ]
} ],
"errors": [ {
"code": "102", "codeText": "Data type error", "severity": "Error",
"message": "XSD validation: The 'PID_8_AdministrativeSex' element is invalid - The value 'X' is invalid according to its datatype … - The Enumeration constraint failed.",
"location": "PID[3].8(1)", "controlId": "MSG00003"
} ]
}errors[]carry the HL7 table 0357code,codeText,severity(ErrororWarning),message,controlIdand alocation.- Locations read
SEGMENT[n].field(repetition).component.subcomponent, wherenis the segment's position in the message:PID[3].8(1)is the third segment (the PID), field 8, first repetition. - The document is still returned when validation fails, so you can log or inspect it.
ACK codes, and when the action fails
| Result | Meaning |
|---|---|
| AA | Accepted. |
| AE | Structure or validation errors. ERR segments describe them (v2.5+ layout with ERL location, table 0357 code, severity and ERR-8 text; ERR-1 for v2.4 and earlier). |
| AR | Cannot process: no MSH, no schema, or an unsupported version. |
| Action fails (400 / 500) | Only a missing message (400) or an unexpected error (500). License problems fail with 403. |
HL7 problems never fail the action
Check success or ackCode, route the errors, and return ack to the sender. That way a bad message gets a proper AE or AR instead of a failed run.