You can use the following:

<assign property='target.Source' value='source.Source' action='set'/>

This applies to any body property. Notice the difference between source (lowercase 's') representing the source message and Source (uppercase 'S') representing the body property. The more general syntax would be:

<assign property='target.BodyPropName' value='source.BodyPropName' action='set'/>

If you are using the graphical editor, you add a set action and type in the Property and Value.

 

That sounds correct. You should also have a Red Update button when you change the class. When you click that Update button, the component will start using your new code. If you do not have the update button you can restart the component by double clicking on the component and clicking Restart.

If that does not do the trick, perhaps you can post your code and ACK related settings for your component. I'm also interested to hear what is happening. Is the standard ACK being returned? No ACK at all?

You can override the OnConstructReply method from EnsLib.HL7.Service.Standard. The following worked for me.

Class DC.CustomACKBS Extends EnsLib.HL7.Service.TCPService
{

Method OnConstructReply(Output pReplyDoc As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As %String, ByRef pSC As %Status, pEarlyAck As %Boolean) As %Status
{
    Set pReplyDoc=##class(EnsLib.HL7.Message).%New()
    Set pReplyDoc.DocType="2.4:ACK"
    Set MSHStr="MSH|^~\&|EnsembleHL7|ISC|ARiM Server|ROWA|"_$REPLACE($REPLACE($ZDATETIME($HOROLOG,8,1),":",""), " ","")_"||ACK|"_pOriginalDoc.GetValueAt("MSH:10")_"|P|2.3"
    Set MSHSeg=##class(EnsLib.HL7.Segment).ImportFromString(MSHStr,.tSC,pOriginalDoc.Separators)
    Set MSAStr="MSA|AA|"_pOriginalDoc.GetValueAt("MSH:10")
    Set MSASeg=##class(EnsLib.HL7.Segment).ImportFromString(MSAStr,.tSC,pOriginalDoc.Separators)
    Set tSC=pReplyDoc.SetSegmentAt(MSHSeg,1)
    Set tSC=pReplyDoc.AppendSegment(MSASeg)

    Quit tSC
}

}

To use the Euro symbol € as an example, it is a character in UTF-8. However, it is not a character in Latin1. Your Business Service uses the Default Char Encoding setting to read the message, so it does not read the Euro symbol as you would expect. Changing the Default Char Encoding to "unicode utf-8" would allow the Business Service to read that character as you would expect.

When you output your message, nothing in the message has actually changed (unless you have done some sort of Data Transformation). So, when you open the text editor, which uses UTF-8, you are able to see the Euro symbol again.

Have you tried GetContentArray() from EnsLib.HL7.Message? Then you could do something similar to Testing Virtual Property Paths in the Terminal. For example,

 ClassMethod PrintPropertyPaths()
{
 set string="MSH|^~\&|MIHIN PATIENT GEN|1.2.3.4.5.9.99.999.9999.1004||2.16.840.1.113883.3.1481|20200103000000+0000||ADT^A01^ADT_A01|1092|P|2.6|1091|||||||||Windward General Hospital"_$C(13,10)_
            "EVN||20200110000000+0000|||||1.2.3.4.5.9.99.999.9999.1004"_
            "PID|1|3170|44c8a6bba5c743538e476a813256959b^^^^CKS~000003170^^^^SS||Santana^Pearl||19900609|F||2054-5^Black or African American^HL70005|364 NE Oak Circle^^Trenton^MI^48183||||||||000003170|||N^Not Hispanic or Latino^HL70189|||||||20200110000000+0000|N"_$C(13,10)_
            "PD1|||Windward General Hospital^^^^^^^^^1.2.3.4.5.9.99.999.9999.1004|9999992221^Johnston^Karl^^^^^^^^^^NPI^^^^^^^^MD"_$C(13,10)_
            "PV1|1|I|^^67^1.2.3.4.5.9.99.999.9999.1004||||9999992221^Johnston^Karl^^^^^^^^^^NPI||||||||||||17a5e3aa59a34ad5af017998278a5eb5||||||||||||||||||&HOME^20200110000000+0000|||||||20200103000000DG1|1||Z34.90^Normal pregnancy^I10||20200103000000+0000|F|^Become_Pregnant"_$C(13,10)_
            "IN1|1|1772^STATE HEALTH PLAN|1027|MEDICAID||||||||||||Santana^Pearl^Gladys|||364 NE Oak Circle^^Trenton^MI^48183"_$C(13,10)
 set target=##class(EnsLib.HL7.Message).ImportFromString(string,.status)
 if 'status {do $system.Status.DisplayError(status) quit}
 set target.DocType="2.6:ADT_A01"
 
 do target.GetContentArray(.propertyPaths,, target.DocType)
 for i=1:1:propertyPaths {
   for j=1:1:propertyPaths(i) {
     i, ".", j, propertyPaths(i,j, "name"), !
   }
 }
}

I see two things here. First, in your Data Transformation, since PIDgrpgrp() repeats, you will need to specify a repetition in the parenthesis like PIDgrpgrp(1) for the first repetition.

<assign value='##class(CUSTOM.Training.Functions).DateTime(source.{PIDgrpgrp(1).PIDgrp.PID:7.1})' property='target.{PID:7.1}' action='set' />

Then, in your DateTime method, you will need to return the year. For example, if the DateTime was formatted YYYYMMDD:

ClassMethod DateTime(DateTime As %Integer)
 {
   Set Year = $EXTRACT(DateTime,1,4)
   Quit Year
 }