Can Daml Triggers see choice transactions?


Is it possible for a trigger to react and see the contents of an event resulting from the exercising of a choice on a template? In other words, let’s say someone exercises choice C on template T with arguments args . Can a trigger see this invocation, as well as the args?
My understanding is that the Ledger API would provide this through the Transaction service, but I could not find any Trigger or Daml-Script code in the documentation that does this.


The ledger API provides two transaction streams. One provides you with a “flat transaction” containing just creates and archives (effectively a diff of the active contracts service) while the other gives you the full tree including exercise nodes.

Triggers and the JSON API are built around the flat transaction streams so you don’t get exercises to that.

If you do need access to exercise events you can either write some code using the Java bindings or in some cases, you could try to create a contract as part of the exercise which would then be available via the flat transaction stream and thereby accessible in triggers. Be careful though not to just let those contracts accumulate forever but archive them once they’ve been processed or after some time.

Understood, thank you!