User assignment

Hello.
For example I have 4 accounter with specific code that each one is for one city. I want to assign tasks based on a code that user send me by a form, for example if code is 10 task should assign to accounter10 and if code is 20 task should assign accounter20 and so on. How to do that? I make all accounter in one groupe but i don’t know how to do this.

@amir0082 - have a look at the Candidate Users features of user tasks:

Hi @amir0082 ,

To assign tasks based on a code from a form submission in Camunda 8, you can use process variables, decision logic, and task assignment features. Here’s a general way to do it:


Step-by-Step Implementation:

1. Create the Form (Frontend or Camunda Form)

Create a form with a field like:

{
  "type": "number",
  "key": "countryCode",
  "label": "Country Code"
}

This will set a process variable countryCode when the user submits the form.


2. Add a Service Task or Script Task (Optional)

If needed, you can add a Script Task or Service Task to determine the assignee based on countryCode.

You could use an Expression or a FEEL expression in a task to set a variable assignee like this:

= "accounter" ++ string(countryCode)

This sets the assignee variable to e.g., "accounter10" if countryCode is 10.


3. Assign a User Task to the Right Assignee

In the User Task, you can use a dynamic assignee:

  • Go to your User Task.
  • In the Assignee field, use:
= assignee

So Camunda will assign the task to the user specified in the assignee variable.


Alternative with DMN (Optional)

If logic is more complex than just code-to-name mapping, consider using a DMN table:

countryCode assignee
10 accounter10
20 accounter20
30 accounter30
40 accounter40

Use a Business Rule Task to evaluate the DMN and return the assignee variable.


Notes:

  • Make sure the assignee matches usernames in your Camunda Identity system.
  • Use Connectors or External Tasks if you want more complex logic from a backend.

Thank you very much @aravindhrs for your advice. My problem was solved.
Do you have any thoughts about this problem?