cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti HTML Form

rj1
Champ in-the-making
Champ in-the-making
Hi

Activiti provides two tasks: User Task and Manual Task.

What I am trying to achive is creating a HTML form that can be embedded within an Activiti process. So when the processes starts the HTML form is displayed to the user to add some information. When the user adds in information, then another User Task or Manual Task runs which displays another page which will contain a button and then the process will end when the button has been clicked.

Is this actually possible using Activiti? Looking into it, I am not sure if this is possible.
1 ACCEPTED ANSWER

frederikherema1
Star Contributor
Star Contributor
You should consume the engine Java-API from within your MVC-controller. For example, use the taskService.createTaskQuery().taskAssignee("…").listPage(0,10); to get a list of tasks open for a user.

After that, create a detail-screen for a task, that renders the required form based on the formKey (can be specified in the process-definition XML) or the form-properties. When the user has entered the data in your UI, and the filled in data arched you're controller, complete the task, submitting any variables with it using taskService.completeTask(taskId, variables) or formService.submitTaskForm(…).

View answer in original post

5 REPLIES 5

frederikherema1
Star Contributor
Star Contributor
It's possible to add those HTML's as part of your bar-deployment and fetch them later on using repositoryService.getDeploymentResource(…) and display them in you're UI-technology. Another option is to use the getRenderedForm(…), which returns the same resource but pre-processes using expressions. This way you can replace certain placeholders in the HTML by actual process-variables. See the user guide for details, however, the "rendered form" approach doesn't have any means of "submitting" the data back to the process.

Your UI-technology should display the form and when submitted, extract the values and pass those values to the activiti-engine, using taskService.completeTask(taskId, variablesReceivedFromUi).

rj1
Champ in-the-making
Champ in-the-making
Thanks for your reply.

In Activiti can you pause a process without using Activiti Explorer as the UI? Actually, what I am trying to achive is:

We have Spring MVC that starts the process. The process is made up of a number of custom JavaDelegates. What we would like to do now is:

1) Add a User Task as part of the process, so the User does something. However, not using Activiti Explorer at all.
2) To pause a process

As you can see, the front end will call one REST endpoint that goes through the Spring MVC Controller. Now you can assume we have many User Task. Suppose the user has completed one part of the full process and they are a number of User Tasks. We don't want the user next time to do something they have already done. Will this be a different endpoint or we use the same endpoint?

For example, the first process might be to create a record. The next might be a User Task enter further details. So at this point, I would expect the process to pause and wait for the user enters the further details. But, the further details not through Activiit Explorer. What are the options available?

trademak
Star Contributor
Star Contributor
I don't get the question. When you use a user task, the process instance is already "paused", until the user task is completed. It doesn't matter if you use the Activiti Explorer or not. Can you please elaborate a bit more on your question?

Best regards,

rj1
Champ in-the-making
Champ in-the-making
How can we use our UI technology instead of Activiti Explorer?

So what I am trying to say, suppose we a process that consists of three processes:

1) Create a record - a JavaDelegate
2) Update a record - a JavaDelegate
3) Require further details - a User Task

This is a full process connected together. Actually, this is only an example, but this full process is started from an Spring MVC Controller. We use JSON as input and output. My question is, how do I redirect the user to our UI page to allow him to give us more details and use this new details inside the running process. This new details is in JSON format. How can this be achived? The UI technology we use is JavaScript.

frederikherema1
Star Contributor
Star Contributor
You should consume the engine Java-API from within your MVC-controller. For example, use the taskService.createTaskQuery().taskAssignee("…").listPage(0,10); to get a list of tasks open for a user.

After that, create a detail-screen for a task, that renders the required form based on the formKey (can be specified in the process-definition XML) or the form-properties. When the user has entered the data in your UI, and the filled in data arched you're controller, complete the task, submitting any variables with it using taskService.completeTask(taskId, variables) or formService.submitTaskForm(…).