Suspend a Task

Hello, I have a question, and I’m not sure if this phenomenon can be handled with Camunda. Here’s the scenario: You have a process, and an exception occurs within that process. The current process is temporarily suspended. Then, based on a value check, you are directed to another process, which is completed, and the data may flow back into the initial process. Afterward, the initial process either continues or is terminated. Is it possible to achieve this using Camunda Modeler, preferably without programming?

Hello my friend!

I’m not sure if the behavior of the Camunda 8 is the same as the 7 at this point, but I believe it is.

  • When an exception occurs, if it has not been previously handled, this generates an incident in camunda, and Incidents need to be handled manually, as it is something unexpected, which is outside the business rules or scope of your process modeling.

  • To get this behavior you want, we could not let the exception be generated, programmatically creating a logic so that if an exception is caught, your code can execute this behavior.

An example could be, create a logic in case a certain exception is thrown, this exception is caught and in this scope a bpmnError is thrown.
With this you can handle using an Error Boundary Event in your modeler.

And to return to the beginning of your process, you can use a message event.

But remembering that, if your code allows the exception to occur, you will not be able to do anything but manually handle the problem.

I hope this helps!

William Robert Alves

I see, because it’s like this: I wanted to model a process where you can place an order. Just before you place the order, it is checked whether you have met a minimum contribution. Before the verification begins, the process is briefly paused, and then you are redirected to another process. Let’s say the minimum contribution has not been met; the process is paused, and based on the value, you are directed to a process that states that the minimum contribution has not been reached, and then the process ends. The paused process is also terminated. I thought this could be solved using a DMN task, so it would not be possible without programming in Camunda. I was able to solve this in another workflow management system.

Now I understand your process better, friend!

Yes, this can be done using DMN to validate the contribution value, and after triggering the message to the user informing that the contribution is not enough, you can use a “terminate event” to end the stopped instance.

Or you can also use a message event if they are in separate scopes, to inform that the instance in question must be terminated, because the “terminate event” will “kill” the tokens of the instance that are in the same scope, and the message event can be used to “warn” other scopes to move on to some other activity.

So you can, for example, send a message with the variable “contributionApproved == false” to the other scope, and in this scope have an event based gateway that will validate whether the contributionApproved is true or false, and accordingly, it will proceed to a different path.

William Robert Alves

I understand, okay. One question: how can I set it up with the DMN task so that the value goes into the task and decides which task comes next? More specifically, what is a DMN task? Is it essentially a simplification of XOR? Can boolean values, like those in checkboxes, also include integer values and string values?

No my friend!
DMN is much more than an XOR, with DMN you can create validations with very complex rules, according to input parameters, and for each case define a different output.

For example, you can create a simple DMN process that validates a person’s salary range, and based on that salary range and credit score, offer a different type of loan.

Then you would create a column that would define the salary ranges, and another column with the credit score.

And then a column with the “output” which would be the released loan amount.

Then you would put in the salary range column:

And in the score column you would put:

So in the output column you would put that the released loan amount would be $30000.

in the second line you would do something similar, but defining another rule… for example if the salary range is between 3001 and 5000 and the score is >=800 the loan release would be $40000.

And so you can create different rules to validate the input data.
This was just a very simple example, but the possibilities are MANY!

Below is the link to Camunda’s official documentation that explains everything you need to know about DMNs.

I hope this help my bro!

William Robert Alves

So just completing my answer above… the DMN task is a task like any other in Camunda, but you will define your decision rules in it, and when your processInstance arrives in this task, the data will be validated by the DMN accordingly with what you set in it.

Take a look on this Camunda DMN course bro… thats great!

William Robert Alves

1 Like

I see, so in my process, I would have an input, and it would be better to use the XOR in this case. A question: if I say that checkbox A and B must be selected for it to proceed to this action, could this be done using DMN?

To verify the necessity of using DMNs, we need to assess the complexity and amount of possibilities for different combinations of inputs and outputs.

In cases where we can obtain several different results, or in cases where we can have numerous different inputs to make the comparison and determine a result, in this case the use of DMNs is valid.

In simpler cases where only 2 checkboxes need to be validated, as mentioned, this can be done through an XOR Gateway, validating both if they are “true” and following path A, otherwise, following path B.

I hope this helps!

William Robert Alves

Thank you, I will do it that way using the XOR. Thank you very much!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.