AnsweredAssumed Answered

Modifing userTask's formKey using Activit API

Question asked by on Apr 12, 2014
Latest reply on Apr 22, 2014 by frederikheremans1

I'm trying to modify the form key for a userTask using Activiti API. <!–break–>I've seen no method in FormService to achieve this, so, my first approach is to get the XML of the currently deployed process, add or modify the userTask "activiti:formKey" attribute, and redeploy it with the same name.
Lokks like it is correctly working, however, when it is done more than once, activiti engine seems to hang.
I've deployed an Activiti Explorer pointing to the same database, and I can see my deployment corerctly modify, but when I try to delete that deployment through Activiti Explorer, I have to reload the page myself to get it refreshed.

This is the code used for deploying:

DeploymentBuilder deploymentBuilder = new DeploymentBuilderImpl((RepositoryServiceImpl)this.processEngine.getRepositoryService());
deploymentBuilder.addInputStream(bpmnResourceName, new ByteArrayInputStream(getStringFromDocument(processDocument).getBytes()));,processDefinition.getDiagramResourceName().indexOf(".process.png")));

where getStringFromDocument(processDocument).getBytes()) returns the modified process XML. I've checked it out and it is returning exactly the same  as the original ".bpmn20.xml" file, but with the corresponding "activiti:formKey" added .
"bpmnResourceName" is the same name as original deployment; for example, "MyProcess.bpmn20.xml".
"processDefinition" is the processDefinition I'm trying to modify.

Been searching around the forum but haven't found any related topic..
Is it the correct approach? Is there any other approach to modify a task's formkey using Activiti API?

Thanks in advance.