XOR Gateway

I have a question. I have a banking process where a customer selects either a personal account or a business account using an XOR gateway. I’ve noticed that I need to input a variable in the XOR to determine which task to go to. Can I set it up in a way that both tasks are available in the task list? For example, have both “Create Personal Account” and “Create Business Account” tasks available. Currently, when I complete the “Create Personal Account” task, the other task disappears. Is it possible to set it up so that both tasks remain available?

Next, we have another XOR question. A reviewer selects “true” in the form, and the request is approved. In the XOR, I need to input a variable to direct it to the task where it was previously accepted in the form using a boolean variable. But what if I didn’t select it because I didn’t approve it? How can I set it up so that the process goes to the task where it was not accepted, where the value is “false”?

Hello my dear!

I would need to better understand your BPM and business context to suggest a better way to model this.

But let’s go…

Can you do this by placing an Inclusive Gateway and a conditional event in each of the create account tasks, evaluating a condition whether or not the person wants to create that type of account, and if not, the conditional event pulls the instance to the junction of inclusive gateway?

something like this…

image

This second question I apologize but I did not understand.
If you want to try to explain it to me so I can understand better, I’ll be happy to help.

i hope this helps!

Regards.
William Robert Alves

It is so. As a customer at a bank, you have the choice to select either a business account or a personal account. Both of these tasks should be displayed in the task list. You are only allowed to select either one or the other. I have seen that XOR conditions need to be applied, for example: if the value is greater than 20, the system automatically proceeds to the corresponding task, but if the user has the choice for both, they can decide. For the second question, I could show you my process so that you can gain a better understanding.

To show the 2 in the task list, you can model it according to my example above, so both tasks will appear in the list, but you must add an “execution listner” as END in each of the User tasks, to create a control variable like this that the task is completed.

This variable must be validated in the conditional boundary event, that is, when this variable is CREATED, it means that it was the task chosen by the user, and it must skip the other activity.

For example:

Create an execution listner in your user task of “Create business account”, and put:
${execution.setVariable("businessAccountCreated", true)}

In your “conditional boundary event” of the “Create personal account” task, validate the “businessAccountCreated” variable to check if the variable is set to “true”, meaning that it was created, and if it was created, that means the business account was chosen.

So put in your conditional event the following:

${businessAccountCreated} or ${businessAccountCreated == true}

This will cause your conditional boundary event to remove the token from the instance of this activity when the user completes the other task.

Remembering that you can use this approach in a few different ways, for example using “setVariableLocal()” if you are going to use this validation only in the inserted context, or even validating if the variable exists with the “hasVariable()” method.

Regarding your other question, if you want and can show us your BPM and explain it better, that would be great!

Regards.
William Robert Alves


As you can see in the first image, I have the variable “Approve_Leave.” If I select it, it should go to the task using the XOR gateway. But if I don’t select it, it should go to the task with the XOR where it’s not approved.

In the second image, what I mean is that if the user has the option to choose a personal or business account, both should appear in the task list. If one is selected, the other task should disappear. Can you understand my thought? I’ve seen that when using XOR, you have to enter a variable for it to go to the task, but here the user can decide for themselves.

So, for example, in your first image, the checkbox is marked, it follows one path, and if it is not marked, it follows another, in this flow you must use the exclusive gateway validating the checkbox variable.

In the case of the second image, for the two tasks to appear in the task list, I believe the best idea is to use the way I showed above using the parallel gateway, because as soon as it completes ONE of the activities, be it the business or personal account, the other should disappear from the task list.

In case you want to do this validation before appearing in the task list, for example in a form where he must choose whether he wants a business or personal account, you can also create a check box where it will say “personal account” and "business account ", and validate this in an XOR (exclusive gateway).

If there is a possibility for the user to be able to choose the 2 accounts, you can use the INCLUSIVE GATEWAY, as this allows you to direct the instance token to ONE or MORE activities according to the flow validation.

I’m sorry if I didn’t quite understand your idea, but I’m at your disposal to find the best solution.

William Robert Alves

I understand it, but how do I validate it with the ‘approve leave’? The problem is, I don’t know what to write. Secondly, I find using the parallel gateway the best option, but how do I incorporate the boundary? What do I need to input there?

In the second image, what I mean is that if the user has the option to choose a personal or business account, both should appear in the task list. If one is selected, the other task should disappear.

A user can never choose his tasks like this in a task/form. A user can only claim tasks from the task list. If you have a drop down with account types then you can save that value in a variable and use it in a gateway. So for each of those tasks you add a gateway to check if the task should be executed and if not you just go around. You can then run the account creation tasks in parallel.

Why do you need two different tasks to create an account? Can’t you just have a task “create account” and take the account type from the variable?

1 Like

The user can choose between two tasks because they have the option to select either one or the other.

Hello!

@cma
When I said choose between one task or another… I imagined a step before, for example a form where he would choose “personal account” or “business account”, and according to his choice in this previous form, he would send the instance to a different path.

Can you show me what I need to enter in the Boundary Event?

@FC_Catalonia Hello!

You can do something similar to what I reported in the “quote” my dear.

This way when the two tasks will appear in the user’s task list, but when the user completes the first task, the other one will automatically be finished.

Take the test and check if this is exactly what you need.

Do the same process also for the other user task, just changing the validations.

Create an execution listner in your user task of “Create personal account”, and put:
${execution.setVariable("personalAccountCreated", true)}

In your “conditional boundary event” of the “Create business account” task, validate the “personalAccountCreated” variable to check if the variable is set to “true”, meaning that it was created, and if it was created, that means the business account was chosen.

So put in your conditional event the following:

${personalAccountCreated} or ${personalAccountCreated == true}

Anything you need, call me!

Cya!
William Robert Alves

Thank you very much, thank you. I will try it out and report back to you tomorrow. Would it be possible for you to answer my other question about multiple items in a task ?

Screenshot 2023-06-20 154844


Hello! As you can see in the pictures, there is no event listener in my case. I looked it up, and it seems that there is no such thing in Camunda 8. Is this information correct? If yes, how could I have solved it?

OMG! I apologize, I didn’t realize the forum was about Camunda 8, and I gave you instructions on Camunda 7. :open_mouth:

My sincere apologies, please disregard my previous comments. :confounded: :confounded:

I still don’t understand much about Camunda 8, but from what I’ve seen “conditional events” are not supported.

If anyone can help our friend regarding his doubt, we appreciate it.

No problem. In Camunda 8, are the other events also non-executable, or is it only the conditional event?

Do you know a way, how to do it?

Maybe I do, I actually don’t know because the things you say are too confusing for me. In my opinion you are still confusing different things like tasks, forms and variables, so you should first watch Niall’s BPMN tutorials. Then if you still have problems try to ask the question more clearly. That’s all I can say.

So, here’s how it goes. I have four tasks. In the first task, the user can select the bank where they want to have their bank account. Then, an exclusive gateway follows. My desire is to not input any conditions because in the task list, the user has the option to choose either the business account task or the personal account task. After that, another exclusive gateway follows, and finally, there’s a task where the user can see their input data. Do you understand roughly what I mean? Above, you can see my process that I have modeled. My desire is that after the exclusive gateway, both tasks are displayed in the task list, and if one is chosen, the other cannot be chosen.

Why has the user access to the task list? I would expect a form on a website where the user can enter the data (including bank and account type) then the process is started with this information and a bank employee gets a task to create an account.

If the user is a bank employee then why does he need a workflow to create an account for himself? Who starts your workflow? The user himself? Just to get a task to choose the bank? And then two additional tasks of which one needs to be completed? Doesn’t make any sense to me. Again, the user could start the workflow with all the information and then other user or service tasks can follow to actually create the account.