The tl;dr questions are:
- How can I start another case in Axon Ivy from Java without making the current case scope persistent while also awaiting the case start to finish?
- Is there a public Java API for a
TriggerCall I am missing? Forcing low-code here strikes me as odd.
- Why does a
TriggerActivity persist the case performing it?
Long story:
I currently work on a project where I need to implement the functionality of triggering a case from a UserDialog. The UserDialog is an advanced search form for the entities used in the process while crosschecking with the IWA_Case table.
I got it working by using a low-code trigger element in a callable subprocess which I called via a SubProcessCall - however, this approach had two side effects I dislike:
The case of the search form was persisted as soon as a new case was created from it using a TriggerActivity; although it was not attached to the business process calling it. This leads to pseudo cases in the case list which serve no purpose.
The triggered case is not yet finished with its ScriptStep when I refresh the entities from the actionListener called from the frontend button triggering the new case; this will lead to confusion. However, I couldn't find an await function anywhere.
After the trigger not working as desired, I resorted to redirect to a HTTP start which also works but then I can't redirect because every context seem to be null here - and I have to admit that this strikes me as an anti-pattern because I have to pass my java classes as base64 encoded JSON to make them safe for use in URLs.
I think my issue is related to the way I think about it: For me, the triggered case should perform the actions needed in its BPMN flow. Tomorrow, I'll try to use the case from the triggeredTask field and move the logic from the ScriptStep to the SubProcessCall triggering the process, which I'd consider an anti-pattern as well - it's at least not as clean as I'd like it.