...by Daniel Szego
quote
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Monday, October 8, 2018

Fabric composer tips and tricks - getting type of an asset


If you use inheritance of assets in fabric composer and want to implement a transaction that execution is dependent on the actual asset type, you can use the following convention. Supposing that you have inheriting assets, like:

asset Ancestor identified by assetId {
  o String assetId
}

asset Descendant extends Ancestor{
}

you can query the exact type and the namespace of the asset with the following code:

toState.$type
toState.$namespace