cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a user task Form in customized web application

raveera
Champ in-the-making
Champ in-the-making
Hi There

I am a new to Activiti. I have to create a workflow manager for our document management system.

They don't want to use Activity Explorer.

So I need to build a customize GUI for starting workflows , Reviewing user tasks etc.

So far i have created views for viewing process definitions,user tasks and starting them.

I need to know is there way to render a form using JSP according to User task in our web application.

I knew form will be generated automatically in Activity explorer.Something can we do in our customized application?

If not do i need to use fixed html form for passing values to user tasks?
6 REPLIES 6

sathish1
Champ in-the-making
Champ in-the-making
Yes., There are some good examples from the "Activiti in Action" book. So for example in chapter 6, the book discusses about how to use a Java code to submit the data that was collected from a form service., here is a snippet of the code,

<code>
   Map<String, Object> processVariables = new HashMap<String, Object>();
   List<String> authorList = new ArrayList<String>();
   authorList.add("Tijs Rademakers");
   authorList.add("Ron van Liempd");
   processVariables.put("authorList", authorList);
  
  runtimeService.startProcessInstanceByKey("jpaTest", processVariables);
 
  Task task = taskService.createTaskQuery().singleResult();
  Map<String, String> formProperties = new HashMap<String, String>();
  formProperties.put("booktitle", "Activiti in Action");
  formProperties.put("isbn", "123456");
  formService.submitTaskFormData(task.getId(), formProperties);
</code>

so basically you collect the form data information from a JSP and in a spring service bean process the variable keeping this above code as benchmark.

Cheers.

raveera
Champ in-the-making
Champ in-the-making
thanks a lot I will give it a try

spooky
Champ in-the-making
Champ in-the-making
I have a question that is related to this topic: My goal is to somehow generate a UI out of the properties (in my case a simple Swing-UI). Right now i'm not sure how to implement the renderer. Should I use the FormEngine-Class and create a new FormEngine there (but how can i register a new FormEngine). Or is the idea that i have some sort of logic that retrieves the current task, gets the task properties (FormProperties) and then passes it to a renderer. I think this is how the activiti explorer handles this task. In this case I could just place properties on the task (or use something similar to the form files from activiti explorer) and then render it myself.

So if someone could just clarify the FormEngine, FormService part a little bit more (apart from the UserGuide) that would help a lot

Thanks

jbarrez
Star Contributor
Star Contributor
> Or is the idea that i have some sort of logic that retrieves the current task, gets the task properties (FormProperties) and then passes it to a > renderer.

That would be the approach.

Note that you don't need the properties on itself. You can also use the 'formKey' attribute to do something like activiti:formKey:'aUniqueIdToFindTheRightViewInSwing'. You can get the formKey through the form service.

spooky
Champ in-the-making
Champ in-the-making
Thank you for the answer.

But in case of the formKey attribute I would have pre-rendered (created) UI parts that are then just loaded by my RenderManager (or something like this). Or I could just use an external UI definition stored in a file (like the examples from the activit-explorer) and then interpret them, right?

And one last question: What is the FormEngine doing exactly? But as far as I understand I don't have to worry about it.

jbarrez
Star Contributor
Star Contributor
The formkey would be a string that can uniquely identify which UI you need to show. Which string that is, that is up to you.

You don't have to worry about the FormEngine, it is not used anymore (legacy)