title: Hyperledger Composer: How to push array of assets into another asset's field?
body: <p>I'm trying to re-create one of my chaincode written in GoLang in Composer.
  <strong>Model.cto</strong></p>
  
  <pre><code>asset Carton identified by cartonId {
  o String cartonId
  o String manufacturerId
  o String dateOfDeparture optional
  o String recipient optional 
  o String currentOwner
  o String status
  --&gt; Unit[] units optional
  o Trackrecord[] trackrecord optional 
  }
   transaction MakeCarton {
   --&gt; Unit[] unit
   o String Id
   }
   asset Unit identified by unitId {
   o String unitId
   o String cartonId
   o String manufacturerId
   o String dateOfDeparture
   o String recipient
   o Trackrecord[] trackrecord
   o String currentOwner
   o String status  
    }
  </code></pre>
  
  <p>So I need to create  transaction which creates one carton and accepts array of units and the cartonId.</p>
  
  <pre><code>  function makeCarton(make) {
    var carton =  getFactory().newResource('org.acme.mynetwork','Carton',make.Id);
    //carton.cartonId = make.Id ;
    var unitobjs = new Array() ;
    for(var i=0; i &lt; make.unit.length ; i++) {
    var unitobj =  getFactory().newResource('org.acme.mynetwork','Unit',make.unit[i].unitId) ;                                          
    unitobj = getFactory().newRelationship('org.acme.mynetwork','Unit',make.unit[i].unitId) ;
    unitobjs.push(unitobj) ;
     }
    for(var i = 0 ; i&lt; make.unit.length ; i++) {
    carton.units.push(make.unit[i]) ;
    }
    // getFactory().newRelationship('org.acme.mynetwork','Unit',make.unit[i].unitId)
    carton.manufacturerId= make.unit.manufacturerId ;
    carton.currentOwner = make.unit.currentOwner ;
    carton.status = 'At '+ make.unit.currentOwner ;
    return getAssetRegistry('org.acme.mynetwork.Carton').then(function (assetRegistry) {
          return assetRegistry.add(carton);
      });
      }
  </code></pre>
  
  <p>Submitting this transaction generates an <strong>Error: carton.units undefined</strong></p>