I have two different template(A and B) and both are in different file.
Now I am planning to execute one choice for A template and want to validate one of the field of Template B.
In the below snapshot, LoanRequest is Template A and SyndicatePledge is Template B.
I want to execute the DisburseRequest choice only when the below conditions are satisfied.I am not able to use SyndicatePledge.totalPledge in this choice.
You will need to pass a contract ID of a
SyndicatePledge contract to the
DisburseRequest choice, and in its body
fetch it and access the
totalPledge of the contract you just fetched. You might want to have a look at this page to see an example of a choice using another contract’s data.
I tried but still getting error.
SyndicatePledge is a template, not a contract. You will need to instantiate a contract of that template and pass contract ID for the instance in which you are interested. In the example I linked above, notice how the
Merge choice has an
otherCid argument of type
ContractId Asset. You will need something analogous, with something along the lines of
pledge: ContractId SyndicatePledge.
It’s working now. Thanks for the help.