title: Set Mirth destination to send transform data back as a custom ACK
body: <p>I have a Mirth channel that set up as a web service listener, it receives an ID, build an HL7 query message and send this query and eventually get back an HL7 response.</p>
  
  <ul>
  <li>Channel Name: QueryChanel</li>
  <li>Source Connector Type: Web Service Listener</li>
  <li>Destination Connector Name: QueryToVista</li>
  <li>Destination connector Type:LLP Sender.</li>
  </ul>
  
  <p>This is the typical HL7 response I receive back from my query is as follow: </p>
  
  <pre><code>MSH|~|\&amp;|VAFC RECV|FACILITY|VAFC TRIGGER||20121011141136-0800||ADR~A19|58269|D|2.4|||NE|NE|USA
  MSA|AA|1234|
  QRD|20121011051137|R|I|500000001|||1^ICN|***500000001***|ICN|NI|
  EVN|A1|20121004064809-0800||A1|0^^^^^^^^USVHA\\0363^L^^^NI^TEST FACILITY ID\050\L|20121004064809-0800|050
  PID|1|500000001V075322|500000001V075322^^^USVHA\\0363^NI^VA FACILITY ID\050\L~123123123^^^USSSA\\0363^SS^TEST FACILITY ID\050\L~9^^^USVHA\\0363^PI^VA FACILITY ID\050\L||JOHN^DOE^^^^^L|""|19800502|M||""|""^""^""^""^""^^P^""^""~^^""^""^^^N|""|""|""||S|""||123123123|||""|""||||||""||
  PD1|||SOFTWARE SERVICE^D^050
  ZPD|1||||||||||||||||""
  </code></pre>
  
  <p>I can get all the above to return if I set my Source's Response From parameter to <strong>QueryToVista</strong></p>
  
  <p>However, I want to return only the value <strong><em>500000001</em></strong> from the above message.  I've tried to play around with the transformer in the QueryChanel destination without success.</p>
  
  <p><strong><em>Update:</em></strong></p>
  
  <p>I tried to add a javascriptwriter connector after the QueryToVista connector in the same channel as follow:</p>
  
  <pre><code>   var destination = responseMap.get('QueryToVista');
     var responseMessage = destination.getMessage();
  
     //Fails with following error: TypeError: Cannot read property "QRD.4" from undefined
     var customack = ResponseFactory.getSuccessResponse(responseMessage['QRD']['QRD.4']  ['QRD.4.1'].toString())**
  
  
     //work but send the whole HL7 message
     var customack = ResponseFactory.getSuccessResponse(responseMessage.toString())**
  
  
     responseMap.put('Barcode', customack);
  </code></pre>
  
  <p>I can't seem to use the normal transformation to retrieve the element at all. 
  Thank you.</p>