# Choice : Archive current contract

**URL:** <https://forum.canton.network/t/choice-archive-current-contract/4846>\
**Category:** App Development\
**Created:** [July 6, 2022, 5:10am UTC](https://forum.canton.network/t/choice-archive-current-contract/4846 "2022-07-06T05:10:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![prajwalhegde3](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@prajwalhegde3](https://forum.canton.network/u/prajwalhegde3)\
**Post date:** [July 6, 2022, 5:10am UTC](https://forum.canton.network/t/choice-archive-current-contract/4846/1 "2022-07-06T05:10:32Z")

</div>

Hi Everyone,

I have been trying to create a choice where “signatory” party/s can exercise a choice on a specific contract to archive it.

```haskell
choice Archive_Contract : ()
      controller signatory
      do
        exercise [...] Archive

```

I guess, I have to pass the current **contractId** instead of **[…]**. Not sure if this is the right approach but I tried passing it as “ **this.ContractId** ” , but seems like its giving me a error.

Can anyone help me with the correct syntax.

Thank you!

---

<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:** [July 6, 2022, 5:40am UTC](https://forum.canton.network/t/choice-archive-current-contract/4846/2 "2022-07-06T05:40:55Z")

</div>

A contract is archived by default once a choice is exercised. Assuming you don’t have the `nonconsuming` keyword in front of the choice, you don’t need to perform anything. You can just `return ()`,

more about nonconsuming here  
[https://docs.daml.com/daml/reference/choices.html#non-consuming-choices](https://docs.daml.com/daml/reference/choices.html#non-consuming-choices)

---

<div class="post-metadata">

**Author:** ![prajwalhegde3](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@prajwalhegde3](https://forum.canton.network/u/prajwalhegde3)\
**Post date:** [July 6, 2022, 7:32am UTC](https://forum.canton.network/t/choice-archive-current-contract/4846/3 "2022-07-06T07:32:09Z")

</div>

Thank you @rikotacards

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [July 6, 2022, 7:33am UTC](https://forum.canton.network/t/choice-archive-current-contract/4846/4 "2022-07-06T07:33:36Z")

</div>

Once you’ve changed it to a non-consuming choice, you can use [self](https://discuss.daml.com/t/getting-contract-id-inside-the-contract/4781/2) to get access to the contract id of the current contract.

---

<div class="post-metadata">

**Author:** ![prajwalhegde3](https://avatars.discourse-cdn.com/v4/letter/p/dfb087/32.png) [@prajwalhegde3](https://forum.canton.network/u/prajwalhegde3)\
**Post date:** [July 7, 2022, 7:47am UTC](https://forum.canton.network/t/choice-archive-current-contract/4846/5 "2022-07-07T07:47:11Z")

</div>

Thank you @cocreature

I do have one more question though…

As per the DAML documentation Archive choice is implicitly added to every template.

Currently I have a Java GRPC method to invoke other choices defined in the template using the “CommandServiceGrpc” stub, so wanted to know if we can invoke this Archive choice from the same as well.

Ref:  
[https://docs.daml.com/daml/intro/4\_Transformations.html#the-archive-choice](https://docs.daml.com/daml/intro/4_Transformations.html#the-archive-choice)

Thank you!!

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [July 7, 2022, 10:27am UTC](https://forum.canton.network/t/choice-archive-current-contract/4846/6 "2022-07-07T10:27:32Z")

</div>

The choice is implicitly added by the compiler. So in Daml-LF it always exists and it’s available over the ledger API. The Java codegen should generate it for you like any other choice. If you don’t use the codegen, just call the choice called `Archive`.
