# How to do Interactions of two choice from different template

**URL:** <https://forum.canton.network/t/how-to-do-interactions-of-two-choice-from-different-template/6140>\
**Category:** App Development\
**Tags:** daml, features and bugs\
**Created:** [February 17, 2023, 12:29pm UTC](https://forum.canton.network/t/how-to-do-interactions-of-two-choice-from-different-template/6140 "2023-02-17T12:29:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshayvchavh](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/akshayvchavh/32/5905_2.png) [@akshayvchavh](https://forum.canton.network/u/akshayvchavh)\
**Post date:** [February 17, 2023, 12:29pm UTC](https://forum.canton.network/t/how-to-do-interactions-of-two-choice-from-different-template/6140/1 "2023-02-17T12:29:41Z")

</div>

Hi there ,I am working on two choices which are in 2 different template. How can I make changes in of one choice from one template to another choice of another template and change the parameters.  
For eg :- my choice from Invoice template and want to change the status.

---

<div class="post-metadata">

**Author:** ![a\_putkov](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/a_putkov/32/2971_2.png) [@a\_putkov](https://forum.canton.network/u/a_putkov)\
**Post date:** [February 17, 2023, 3:18pm UTC](https://forum.canton.network/t/how-to-do-interactions-of-two-choice-from-different-template/6140/2 "2023-02-17T15:18:09Z")

</div>

@akshayvchavh  
I’m afraid I’m not following what you’re looking to do. Would you mind elaborating? A specific example would probably be most helpful.

---

<div class="post-metadata">

**Author:** ![akshayvchavh](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/akshayvchavh/32/5905_2.png) [@akshayvchavh](https://forum.canton.network/u/akshayvchavh)\
**Post date:** [February 20, 2023, 11:14am UTC](https://forum.canton.network/t/how-to-do-interactions-of-two-choice-from-different-template/6140/3 "2023-02-20T11:14:41Z")

</div>

Here I created UpdatePOVStatus and UpdatePOStatus ,and now I am getting error as Update failed due to fetch of an inactive contract

Code :-  
controller operator can  
nonconsuming VInvSetHospital : ContractId Invoice  
with  
invcid : ContractId Invoice  
hospital: Party  
useremail: Text  
username: Text  
do

```
          let payment_term = foldl(\paymentterm invoiceVendorTerm ->
                      if invoiceVendorTerm.hospital == hospital
                      then paymentterm <> invoiceVendorTerm.auto_payment_hospital
                      else paymentterm
                      ) "" admindetails.invoice_term_setting

          (newinvCid, invoicecontract) <- exercise invcid SetInvoiceHospital with 
                            payment_term = Some payment_term
                            vendor_ach_info= vendordetails.ach_info
                            vendor_address = Some vendordetails.vendoraddress
          addNewLogEvents (operator, vendor, (Some hospital), SendInvoice, 
            (InvoiceLogEntry with invData = invoicecontract), useremail, username, (invcid /= newinvCid))
          
          (poCid, po) <- findPO (operator, hospital, vendor, invoicecontract.invoicedata.invpurchaseorderid)
          (povCid, pov) <- findPOV (operator, hospital, vendor, invoicecontract.invoicedata.invpurchaseorderid)
          -- update po, pov status
          _ <- if isSome poCid then do
              exercise (fromSome poCid) UpdatePOStatus with newpostatus = InvoiceReceived
              pure()
            else pure()

          _ <- if isSome povCid then do
              exercise (fromSome povCid) UpdatePOVStatus with newpostatus = InvoiceSent
              pure()
            else pure()
          
          return (newinvCid)

```

@a_putkov

---

<div class="post-metadata">

**Author:** ![rikotacards](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@rikotacards](https://forum.canton.network/u/rikotacards)\
**Post date:** [February 21, 2023, 4:29am UTC](https://forum.canton.network/t/how-to-do-interactions-of-two-choice-from-different-template/6140/4 "2023-02-21T04:29:55Z")

</div>

The error is as mentioned, “failed due to fetch of an inactive contract”

It looks like you are exercising a choice VInvSetHospital, and you pass in the invcid, I don’t think you’ve copied and pasted the part where you fetch the invoice contract.

or it can be “newpoststatus = InvoiceReceived” But I’m not sure based on this snippet. But the overall issue is, you’re using a contract that has probably been archived or has not yet been created yet.

---

<div class="post-metadata">

**Author:** ![akshayvchavh](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/akshayvchavh/32/5905_2.png) [@akshayvchavh](https://forum.canton.network/u/akshayvchavh)\
**Post date:** [February 21, 2023, 6:33am UTC](https://forum.canton.network/t/how-to-do-interactions-of-two-choice-from-different-template/6140/5 "2023-02-21T06:33:58Z")

</div>

Thanks @rikotacards ,I will try it.
