cancel
Showing results for 
Search instead for 
Did you mean: 

SubmitTaskFormData

piseven
Champ in-the-making
Champ in-the-making
Hi,

i got a use-case, to be able to complete user task that have forms without the activiti explorer
i searched the java-docs and found a method called SubmitTaskFormData. ("Completes a task with the user data that was entered as properties in a task form.")

as parameters there are the task-ID and a map with properties.

can anyone teach me, how to use it right, so that i can "fill" the form from explorer, without using the explorer?
if i was right while i read this, it should be possible programmaticly by using the api  to call a form connected with a task outside the explorer, fill it in, take those data to the map and then complete the task

but i don't know how to do this exactly
1 REPLY 1

tiesebarrell
Champ in-the-making
Champ in-the-making
Hi, not sure this is what you mean, but here's an example how you can work with that part of the API in a unit test. Obviously, if you're not running a test you need a different way to get to the TaskService (via the process engine), but this should give you an idea:


final TaskService taskService = activitiRule.getTaskService();
final TaskQuery taskQuery = taskService.createTaskQuery();
 
taskQuery.taskName("nameOfMyTask");
List<Task> tasks = taskQuery.list();
assertEquals(1, tasks.size());
 
String taskId = tasks.get(0).getId();
Map<String,Object> taskVars = new HashMap<String,Object>();
taskVars.put("amount", 5);
taskVars.put("customerName", "John Doe");
taskVars.put("type", "iPhone");
taskService.complete(taskId, taskVars);

tasks = taskQuery.list();
assertEquals(0, tasks.size());
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.