Designating any party in a list of parties as Controller
App Development4 posts587 views11 likesLast activity Sep 2020
MA
ManishGroverOP
Sep 2020Hi,
I have a template with a list of parties. How can I allow any one of those parties to be able to exercise a choice, and pass that party to the resulting contract?
Example below:
template MyTemplate
with
operator: Party
contacts : [Party]
name: Text
where
signatory operator
observer contacts
controller any one of the contacts can
DoSomething: ContractId SomeProposal
with
newName : Text
do
create SomeProposal with name = newName, operator, (contact who exercised the choice)
template SomeProposal
with
operator: Party
name: Text
contact : Party
where
signatory contact
If there is another way to accomplish these things instead, that’s welcome too.
Thanks!
MA
matt
Sep 2020Can you do something like this using the dynamic choice construct?
choice DoSomething : ContractId SomeProposal
with
contact : Party
newName : Text
controller contact
do
assertMsg "is not a contact" $ contact `elem` contacts
create SomeProposal with name = newName, operator, contact
CO
cocreature
Sep 2020Great answer @matt!
MA
ManishGrover
Sep 2020Thank you Matt! This should work for me.