Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Choose User Action in Task programmatically

Avatar

Level 1

I have a process that has two tasks that is a simple 'approval' process.  I need to be able to programmatically choose either 'Approved' or 'Rejected' for a task so that the process goes to the next task assignment or exits the process and the process ends.

From code how do you get the current task of a process, and action one of the user actions?

Thanks!

1 Reply

Avatar

Level 2

Hi,  try this for ES3

ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

long processId = YOUR_PROCESS_ID;

ProcessManagementQueryService queryService = ProcessManagementClientFactory.getProcessManagementQueryService(myFactory);

List<Task> lst= queryService.getTasksForProcessInstance(processId);

String taskId = lst.get(0).getTaskId() + ""; // i think, the current task is first at collection

String route ="YOUR ROUTE NAME";

ProcessManagementTaskService taskService=ProcessManagementClientFactory.getProcessManagementTaskService(myFactory);

taskService.submitWithPriorData(taskId, "");

taskService.complete(taskId, route);