I am trying to use data record as a maintainer key but getting following error.
/home/nishchal/Test/daml/Test.daml:23:16: error:
• No instance for (IsParties CitizenKey)
arising from a use of ‘toParties’
• In the expression:
toParties ((DA.Internal.Record.getField @"_1" key))
In the first argument of ‘concat’, namely
‘[toParties ((DA.Internal.Record.getField @"_1" key))]’
In the expression:
concat [toParties ((DA.Internal.Record.getField @"_1" key))]typecheck
Here is my template and data record
data CitizenKey = CitizenKey with
citizen : Party
id: Text
deriving(Eq,Show)
data CitizenInfo =CitizenInfo with
citizendetail1 : Text
citizendetail2 : Text
citizendetail3 : Text
deriving(Eq,Show)
template CitizenRegistration
with
registrationCid : CitizenKey
registrationData : CitizenInfo
where
signatory registrationCid.citizen
key (registrationCid,registrationData):(CitizenKey,CitizenInfo)
maintainer key._1
nonconsuming choice UpdateRegistration : ContractId CitizenRegistration
with
newCitizenDetails : CitizenInfo
controller registrationCid.citizen
do
(oldRegistrationCid, oldRegistrationData) <- fetchByKey @CitizenRegistration (key this)
archive oldRegistrationCid
create CitizenRegistration with
registrationCid = oldRegistrationData.registrationCid
registrationData = newCitizenDetails