completeTaskWithForm: correct usage?

Hi,

I am trying to complete a task via a form:

taskService.completeTaskWithForm(task.getId(), formID, null, variables);

Question: how do I get the formId of the task? I can get the formKey (task.getFormKey()), but what is the best way to get the formId?

Thanks,
Wim

Trying to get the FormProperties, I tried the following:

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
FormService formService = processEngine.getFormService();

String barFileName="app.bar";
ZipInputStream inputStream = new ZipInputStream(new FileInputStream("C:\\path\to\\app.bar"));
repositoryService.createDeployment()
        .name(barFileName)
        .addZipInputStream(inputStream)
        .deploy();

System.out.println(formService.
    getStartFormData(repositoryService.createProcessDefinitionQuery().
        processDefinitionKey("test").latestVersion().singleResult().getId())
        .getFormProperties());

The getFormProperties results in an empty List. app.bar can be found here: as well as the flowable.cfg.xml file.

The id to pass is the formDefinitionId, you can get this through the FormRepositoryService. Note that you’d need to have the FormEngine for this, which means you’d need to add the FormEngineConfigurator to the list of configurators of the process engine to have it be booted up together with the process engine.