자산 참조 필드 중 하나를 참여자 참조와 연결하려고하는 트랜잭션을 사용하여 자산을 추가하려고합니다. 하지만 자산을 사용하여 참가자의 이름을 얻으 려 할 때 나를 보여주고 있습니다. undefined
참여자 관계가있는 트랜잭션을 사용하여 자산 추가
참가자가 이미 있습니다. 이 거래 전용 자산을 사용하여 새 참여자를 만들고 싶지 않습니다.
asset TestAsset identified by id {
o String id
--> TestPart part
}
participant TestPart identified by id {
o String id
o String name
}
transaction AddTestAsset {
o String aId
o String pId
}
Logic.js
function addTestAsset(tx) {
var factory = getFactory();
var NAMESPACE = 'org.acme';
var newAsset = factory.newResource(NAMESPACE, 'TestAsset', tx.aId);
newAsset.part = factory.newRelationship(NAMESPACE, 'TestPart', tx.pId);
console.log(newAsset.part.name); //Showing undefined
return getAssetRegistry(NAMESPACE + '.TestAsset')
.then(function (aReg) {
return aReg.add(newAsset);
});
나는 UI 양식에서 aId
및 pId
을 얻고있다.
다른 방법이 있습니까?