You won't believe the solution !!

I needed to change the send instructions with the clone object, pOutput, and NOT the HL7 message object, pRequest.

Example:

ElseIf (tMessageType="ORM") {
            //$$$ThrowOnError(..SendRequestAsync(..VistaTarget, pRequest, 1, "OutputCernerToVistaORM"))
            //  03272025 Must make a new command that uses the clone object instead of the HL7 message object which is immutable
            $$$ThrowOnError(..SendRequestAsync(..VistaTarget, pOutput, 1, "OutputCernerToVistaORM")) // Must use the object for the clone

This is resolved.

Now, I need to add the CR/LF

I moved the $ConstructClone outside the loop but chnages are getting made still

Is there a way to check the contents of the clone?

Code:

Method FromCerner(pRequest As EnsLib.HL7.Message) As %Status
{
    #dim tStatus As %Status = $$$OK
    #dim eException As %Exception.AbstractException
    #dim tOBXSegment As EnsLib.HL7.Segment
    #dim tOBXText As %String
    #dim tItemNumberCount As %Integer = 0
    #dim tItemNumberProcessed As %Integer = 0
    #dim tTotalCostSegment As %Integer = 0
    #dim tOrderType As %String
    #dim As %Interger = 0
    #dim tOBXKey As %Integer = 0
    #dim tOBXTextChanged As %String
    //
    // Set the message
    Set tMessageType = pRequest.GetValueAt("MSH:9.1")
    
    Try {
        // Message Subtype
       // Message Subtype
    Set tMessageSubType = pRequest.GetValueAt("ORCgrp(1).ORC:1")
    //$$$LOGINFO(tMessageSubType_"----- tMessageSubType - = NW -- ")
    //
    // Check if OBR:19 contains "Implant Usage (PSAS)" OR "Issued in Clinic (PSAS)"
    Set tOrderType = pRequest.GetValueAt("ORCgrp(1).OBRuniongrp.OBRunion.OBR:19(1).1")
    //$$$LOGINFO(tOrderType_" ---- tOrderType Ordder Type = Implant Usage (PSAS) for first interation")
    If ((tOrderType["Implant Usage (PSAS)") || (tOrderType["Issued in Clinic (PSAS)")) {
        // First loop: Count occurrences of "Item Number:"
        Set = 1
        Set tItemNumberCount = 0
   Set pOutput = pRequest.%ConstructClone(1) // moved here because %ConstructClone() need only be done at the message object level.
   $$$LOGINFO(pOutput_" ---- pOutput to see if clone is created****")
        While (pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX")'="") {
            Set tOBXText = pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5", .tStatus)
            $$$LOGINFO(tOBXText_"**** "_i_" ---- tOBXText OBX 5 text and i value") // working
            //
            If (tOBXText [ "Item Number:") {
                Set tItemNumberCount = tItemNumberCount + 1
            }
            //
            If (tOBXText[ "Total Cost:") {
                Set tTotalCostSegment = i
                //$$$LOGINFO(tTotalCostSegment_" ------ tTotalCostSegment check Total Cost")
            }
            Set = + 1
        }
        // Second loop: Modify OBX segments if necessary
        Set = 1
  //Set pOutput = pRequest.%ConstructClone(1) //%ConstructClone() need only be done at the message object level.
        Set tItemNumberProcessed = 0
        While (pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX")'="") {
            Set tOBXText = pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5", .tStatus) // using pOutput instead of pRequest
            //$$$LOGINFO(tOBXText_" ---- tOBXText get OBX 5 text")
            If (tOBXText [ "Item Number:") {
                Set tItemNumberProcessed = tItemNumberProcessed + 1
            }
            If (tItemNumberCount > 1) && (tOBXText [ "REASON FOR REQUEST:") {
                set tOBXKey = i
                Set tOBXText=$p(tOBXText,":",2,5) /// OBX 5 text parsed to replace in OBX 5 later
                // Start replacement process
                Do pOutput.SetValueAt(tOBXText,"ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5","set") // was a typo
                //$$$LOGINFO(tOBXText_" ---- OBX 5 parsed to be saved in new OBX 5")
                Set tOBXTextChanged = pOutput.GetValueAt("ORCgrp(1).OBRuniongrp.OBXgrp("_i_").OBX:5") // typo
                //$$$LOGINFO(i_" **** "_tOBXTextChanged_" --- i --- tOBXTextChanged, Is OBX 5 changed???") // OBX 5 is changed but not saved
            }
            Set = + 1
        }
    }
            //Do pOutput.%Save()
            Set tSave2 = pOutput.%Save()
            
            $$$LOGINFO(tSave2_" ---- did it save")
            //

The OBX 5 changes just aren't getting saved