How can I change the signatory of a contract from one party to another
- cohen.avrahamOP
G-d willing
Hello,
I am having the following templatetemplate Product with id: Text owner: Party responsible: Party where signatory owner, responsible choice ChangeResponsible : ContractId Product with newRespobsible : Party controller responsible, newRespobsible do create this with responsible = newRespobsibleSay that the owner of the product would like to propose to candidates to be responsible for the product, meaning to be the responsible party of the contract. So, I created a proposal template to represent it:
template ProductResponsibleProposal with lessor: Party lessee: Party product: ContractId Product where signatory lessor observer lessee choice AcceptResponsibleProposal : ContractId RentAgreement controller lessee do exercise product ChangeResponsible with newRespobsible = lesseeI created a script for that:
setup : Script () setup = script do alice <- allocateParty "alice" bob <- allocateParty "bob" pen <- submit alice do createCmd Product with owner = alice, responsible = alice, id ="1" proposalId <- submit alice do createCmd ProductResponsibleProposal with lessor = alice lessee = bob product = pen submit bob do exerciseCmd proposalId AcceptResponsibleProposal pure ()However, that does not work since the bob, the lesser, is not visible in the Product contract. So, I tried creating an agreement between them before exercising the choice.
I created the following template:template ProductResponsibleAgreement with lessor: Party lessee: Party product: ContractId Product where signatory lessor, lessee choice ChangeResponsibility : ContractId Product controller lessee, lessor do exercise product ChangeResponsible with newRespobsible = lesseeI updated the choice in the proposal for the following;
choice AcceptResponsibleProposal : ContractId ProductResponsibleAgreement controller lessee do a <- create ProductResponsibleAgreement with .. exercise a ChangeResponsibility return aAnd, since the agreement has both signatories, bob & alice, exercising the choice from the agreement should work. However, that does not work as again for the same visibility error.
How can I resolve this, so bob can be the responsible party for the product in one step only on accepting the proposal?
I don’t want to create the agreement first, and then ask bob (as a second step) to exercise theAcceptResponsibleProposalchoice at another time. I want it all in one go. - Gary_Verhaegen
It’s a bit unclear to me exactly what your workflow is supposed to do here, but the gist of the answer is, I think, that in order for Bob to be able to exercise a choice that requires a Product, Bob needs to be an observer on that Product.