Okay am new to DAML and have extensive Java programming experience. Now, I have a question. In Java, 'Class A' has 'Class B', and like this, A can use 'state' of 'Class B'. I want to do something like this in DAML too.
If I think template as a class, 'contract id' is an instance of it, and the 'state' of the template (the things we declare in 'with') should be accessible in another template when passed in as a parameter, but I get compilation errors in the code I wrote.
One way to proceed is to send 'party' as a parameter instead of contract ID, and then try to access the party in contract, but I wanted to check if/ what is wrong with this!
Thanks in advance!
First template
daml 1.2
module RFP where
template RFP
with
requestorCEO: Party
where
signatory requestorCEO
Second template
daml 1.2
module InternalComm where
import RFP
template InternalComm
with
-- RFP is sent in as a parameter to this template.
rfpContractID: ContractId RFP
where
-- Here with this, I'm trying to say that the CEO who would be approving
-- an RFP is the signatory for internal communications too. It is the
-- below line that fails with compilation error.
signatory rfpContractID.requestorCEO
This is the actual error message I get for aforementioned problem. Any thoughts would be greatly appreciated!
No instance for (DA.Internal.Record.HasField
"requestorCEO" (ContractId RFP) a0)