How to make the "Forms" tab available for Service Tasks?

Hello everyone,

We are developing company ERP system and using Camunda BPM as a process engine.

One of the main features of our system is the creation of the tasks in the company task tracker. We’re not using User Tasks and the Tasklist provided by Camunda Webapps. Instead of it, we implemented the integration with company’s task tracker system. Currently, we use ServiceTask as an activity type for such tasks.

Our current need is to provide the process engineer the convenient way to configure the form which assignee of the task should fill. The configuration of forms in User Tasks is exactly what we need, but I couldn’t find an ability to add this tab for Service Tasks.

So, I have some questions:

  1. Is there a way to extend Service Task editing UI and add the “Forms” tab?
  2. If #1 is no, can we process user task in the same way as service tasks? I mean, can we specify activity handler for User Tasks?

Thanks in advance

Hi @dkarviga

1- Service task is not intended to be used by user. That is why there shouldn’t be a UI for it.

2- Yes, you can use TaskListener to execute custom Java logic or an expression upon the occurrence of a certain task-related event.

https://docs.camunda.org/manual/7.10/user-guide/process-engine/delegation-code/#task-listener

1 Like

Hi @hassang

Thanks for your answer.

Is there a way to use the User Task without Task List? So, Camunda should not create new tasks in the task list, we want to implement the full logic of User Task processing using our custom Java code. Or User Task is designed to work with Task List only?

Currently, we implement the workflow we need using Service Task with Java handler specified as camunda:delegateExpression. Our custom activity handler does the following things:

  1. Creates a new Redmine issue on activity executions
  2. Leaves the execution when the issue in Redmine system resolved

All the properties are configured as input parameters (using element templates)

custom_form

Currently, I tend to decide to keep our current implementation with Service Tasks and configure the fields that Redmine user should fill in the taks using the “Extensions” tab and just want to make sure that my assumption that User Task is closely related to Task List is valid.

validation_fields

(As the result, Redmine will show the form with three inputs: employeeId, redmineUserId, photoUrl. Redmine user should fill these fields before ticket resolving).

Hi @dkarviga,

you can skip the Camunda Tasklist and implement your own. The API is there, either as Java- (https://docs.camunda.org/javadoc/camunda-bpm-platform/7.10/index.html?org/camunda/bpm/engine/TaskService.html) or as REST-Api: https://docs.camunda.org/manual/7.10/reference/rest/task/

The process engine will wait, until taskService.complete() is called. This is not possible with service tasks and delegate implementation.

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,

Thank you for the hint.

I’ve studied the source code deeper. It seems that there is no way to fully replace TaskList as the creation of Task in TaskList is made outside of TaskService and cannot be overridden. There is UserTaskActivityBehavior class which call TaskEntity.createAndInsert static method. UserTaskActivityBehavior instance itself is not injected too and created within BpmnParse.parseUserTask method.

   @Override
  public void performExecution(ActivityExecution execution) throws Exception {
    TaskEntity task = TaskEntity.createAndInsert(execution);

    taskDecorator.decorate(task, execution);

    Context.getCommandContext()
      .getHistoricTaskInstanceManager()
      .createHistoricTask(task);

    // All properties set, now firing 'create' event
    task.fireEvent(TaskListener.EVENTNAME_CREATE);
  }

So, based on this information, we have the following option only:

  1. Create Camunda Modeler template with ExecutionListener configured for User Task (camunda templates doesn’t support Task Listeners (https://github.com/camunda/camunda-modeler/issues/752)
  2. Execution Listener will create a task in third-party task tracker on “create” event
  3. When the Redmine task is resolved, our custom Java code should call TaskService.complete method for the task created for this execution.

The task in Task List will be created anyway, but we may just ignore this functionality.

Thanks, we’ll consider this option for our implementation.