Efferent-Health/HL7-dotnetcore

AddSegmentMSH throws exception 'Failed to validate the message with error - Message Type & Trigger Event value not found in message'

Closed this issue · 1 comments

I want to create a MDM_T02 message with a MSH, PID, TXA and OBX segment. Based on

https://github.com/Efferent-Health/HL7-dotnetcore#adding-a-message-header

I started with this

Message mdmMessage = new Message();

mdmMessage.AddSegmentMSH(
    "sendingApplication",
    "sendingFacility",
    "receivingApplication",
    "receivingFacility",
    string.Empty,
    "MDM_T02",
    $"Id{DateTime.Now.Ticks}",
    "P",
    "2.6");

But unfortunately AddSegmentMSH throws the following exception

Failed to validate the message with error - Message Type & Trigger Event value not found in message

What is missing?

Thanks in advance

The code should work if you change MDM_T02 to MDM^T02