AnsweredAssumed Answered

Exception on fetching process with non-completed startup form

Question asked by mteira on Sep 7, 2018

Hello all,

I'm facing a problem with Activiti 6.0.0 when a BPMN process with a defined start form (start event with activiti:formKey defined) is started programatically using the engine runtimeService like this:


                        Collections.singletonMap("deviceSerialNumber",  "mySerialNumber"));


The process starts normally and runs into an User Task. When I try to use activiti-ui to claim and process the task, an internal error gets thrown:


Caused by: org.activiti.form.engine.ActivitiFormException: No submitted form could be found
        at org.activiti.form.engine.impl.cmd.GetCompletedFormDefinitionCmd.resolveSubmittedForm(
        at org.activiti.form.engine.impl.cmd.GetCompletedFormDefinitionCmd.execute(
        at org.activiti.form.engine.impl.cmd.GetCompletedFormDefinitionCmd.execute(
        at org.activiti.form.engine.impl.interceptor.CommandInvoker.execute(
        at org.activiti.form.engine.impl.interceptor.CommandContextInterceptor.execute(
        at org.activiti.form.engine.impl.interceptor.LogInterceptor.execute(
        at org.activiti.form.engine.impl.cfg.CommandExecutorImpl.execute(
        at org.activiti.form.engine.impl.cfg.CommandExecutorImpl.execute(
        at org.activiti.form.engine.impl.FormServiceImpl.getCompletedTaskFormDefinitionByKeyAndParentDeploymentId(


The problem seems to be related to the fact that ProcessInstanceResource.getProcessInstance assumes that when the start event has a formKey defined, it must have been started by means of the start form, and therefore it tries to fetch it. In, we can find:


  protected FormDefinition getStartFormDefinition(String processDefinitionId, ProcessDefinitionEntity processDefinition, String processInstanceId) {
    FormDefinition formDefinition = null;
    BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
    Process process = bpmnModel.getProcessById(processDefinition.getKey());
    FlowElement startElement = process.getInitialFlowElement();
    if (startElement instanceof StartEvent) {
      StartEvent startEvent = (StartEvent) startElement;
      if (StringUtils.isNotEmpty(startEvent.getFormKey())) {
        formDefinition = formService.getCompletedTaskFormDefinitionByKeyAndParentDeploymentId(startEvent.getFormKey(),
            processDefinition.getDeploymentId(), null, processInstanceId, null, processDefinition.getTenantId());

    return formDefinition;

My question is if this is a valid assumption. In my use case, I normally start the process programatically but I also want to be able to start using activiti-ui by filling up values in a form.


- Should the engine assume that a running process instance must always have a completed startup form if they process definition has a formKey in the start element?

- In case it should, what is the recommended way to achieve what I'm trying to do here? (A process that can be started either programatically or by using a form).


Thanks and best regards,