What is the best way to model capturing a batch of transactions?

Consider the situation where a batch of transactions is captured. Each transaction has some validation applied before the batch is validated, authorised and processed as a whole. How should this be modeled in Camunda?

The obvious BPMN approach is to model each transaction capture as a process, then launch another process to complete the batch processing. However, this is VERY inefficient from a user’s point of view (having to start a new process for each transaction, having the transaction appear again in the inbox if validation fails, rather than getting immediate feedback, not having a view of the transactions captured so far, etc) and introduces additional steps (such as creating some way for the batch processing to be triggered when all transaction have been captured).

From a user point-of-view, it is much easier to build a list of transactions on a single screen, adding transactions until done, and then triggering the batch processing.

Can this be achieved somehow?

This is a very common scenario - what are the preferred approaches?

Is there any reason you wouldn’t want to use an embedded sub process like the following:

https://cawemo.com/shares/8124cd1b-f845-490a-b568-2ad99b2b9647

Thanks Niall.

I am experimenting with something like this, where the user specifies the number of transactions (n) to be captured, and the capturing is modeled as a sequential loop of the subprocess with a loop cardinality of n. Is this what you are suggesting (the number of transactions is not known at the time of modelling)?

As far as I can see, this results in a pretty ugly user experience, where the user clicks “Complete” on the subprocess and they must then pick it up again from their tasklist to capture the next transaction. This happens for however many transactions they have to capture.

Is this how this sort of interaction is being built, or am I missing some way to make it cleaner for the user?

Thanks again.

I might need some more information about what exactly you would like to happen. Especially with regard to the parts of the “transactions” which require a user and the parts that are automated.

Could you create a model that best represents what you’re trying to achieve this would help me understand the use case and help with possible solutions.

@Ettery your description feels like a mix of workflow + pageflow.

So how about something like this:

(Assumption is that you want to store everything in a process as the user may come back over time to add more transactions)

Where your user “Starts” a batch, which starts the parent process. Then in your UI you start to Message the process instance for adding transaction items, and finally a message that the batch is ready to be processed. The Conditional picks up the “ready” and processes each of the transaction items.

You could also make your Perform Batch a multi-instance.

Thank you both for the feedback, I’m new to Camunda and BPMN so a great learning curve.

The situation is very like “Processing a Batch of Orders from a Marketplace” on the BPMN Examples page, except that that appears to be an automated process where in mine the user is capturing the transactions. Here is a simple model.

The way we would normally build this UI would be something like this mock-up:

However, I would like to build it using standard Camunda Tasklist functionality. I’m not wanting to make it look like this mock-up, but I do want a smooth user experience - in particular, each time the user captures a transaction and presses Continue, I’d like the transaction screen to be cleared and presented for the next transaction. So far the only way I have got it to work requires the user to refresh their Tasklist and select the next transaction task to be presented with the capture screen again.

Is there any way around this, or do I need to build a custom screen which interacts with Camunda in the background?

@StephenOTT, my impression is that you are talking about a custom UI or external form? Or do you see a way to do this smoothly in the Tasklist?

Doing it in Tasklist is going to require some “trickery”/magic in the Angular Forms(highly speculative) or you will have to modify the tasklist app.

The tasklist is not designed to auto-take the user to the next task appropriate task.

The use case you are explaining is a very custom UI story, and your first two user tasks are very “pageflow”: Example:

  1. What would you do if the user needed to add a additional transaction, but they are already on the Capture Transaction step?
  2. if a user is on the Specific count or the capture steps, and decides they want to cancel their input process, what do you do?
  3. If the user specifies 10 transactions to capture, and has completed 9, and now is on the 10th, but the tenth cannot validate, how does the user move forward and skip the tenth input? (this one is sort of solvable with the way multi-instance works)

@Ettery what is a transaction and what is the context of the Saving of a transaction?

If you added a data grid to the form and add a validate button to the grid, you could run another process in the background and use the “withVariablesInReturn” parameter to get the result. Basically you are validating the transactions that the user added to the ui as a “helper”. Otherwise you are validating each of the transactions in realtime when the user attempts to complete the task / or starts the process. IMO it would be better to add this to the Start Form, so only a process instance is created when you have successfully validated the submitted batch of transactions

UI Validation could be called from your start form in a button using the REST API. You could submit the values in the data grid into the process, have to validate it, and return the results. You parse the returned results.

The Batch Submission process is the “main” process that is executed when the user “starts” the process. The form where you add the transactions is attached to the Submit Batch Start event. On Process Start, the batch is validated (even if it was already validated through the UI) and if validation fails, then you throw an error in the Validate Batch call activity, and the process will not start.

@StephenOTT - thanks for the input and apologies for the delay, I’m juggling projects. I’m spending some time understanding the Angular “trickery”, what can be achieved and what is desirable… not always the same. I hear what you are saying about only creating the process once the transactions are captured, which sounds sensible.