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

can't complete an action using Java API

Avatar

Level 1

Here is a code snippet to complete a workflow human task in a long lived process with ‘action2’ as route/action for my task.

With a little code change, I was able to complete the task. I introduced Save method from TaskManager before I complete the task.

I could complete task and complete action separately, but the action name supplied doesnt choose the appropirate route.  I see the details in the DB table and ‘selectedAction’ column for the task is populate with ‘action2’ which is being provided in my code below. Need some help in addressing this issue.

I am using ES4 on Win2008R2 with Oracle.

Code Snippet begin:

//Complete Task

FormInstance formInstance = myTaskManager.getEmptyForm();

StringBuffer buffer = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> ");

buffer.append("<LoanApp> <Name>Sam White</Name> <LoanAmount>250000</LoanAmount> ");

buffer.append("<PhoneOrEmail>(555)555-5555</PhoneOrEmail> <ApprovalStatus>");

buffer.append(“action2”);

buffer.append("</ApprovalStatus> </LoanApp>");

Document doc = new Document(buffer.toString().getBytes());

formInstance.setDocument(doc);

formInstance.setXFAData(buffer.toString().getBytes("UTF-8"));

SaveTaskResult saveTaskResult = myTaskManager.save(new Integer(taskId).longValue(), formInstance);

output.append("<br>saveTaskResult.getActionInstanceId() = " + saveTaskResult.getActionInstanceId());

CompleteTaskResult completeTaskResult = myTaskManager.completeTask(new Integer(taskId).longValue(), actionStatus);

            System.out.println("completeTaskResult.getActionId() = " + completeTaskResult.getActionId());

            output.append("<br>Action Id:" + completeTaskResult.getActionId());

            output.append("<br>completeTaskResult.getInvocationId() = " + completeTaskResult.getInvocationId());

            ProcessManager processManager = new ProcessManager(myFactory);

            String act = "act1";

            if("action2".equalsIgnoreCase(actionStatus)){

                act = "act2";

            }

            else if("action3".equalsIgnoreCase(actionStatus)){

                act = "act3";

            }

/*  #1  */            processManager.completeAction(completeTaskResult.getInvocationId());

            output.append("<br>Action Complete");

Code snippet end:

In my example, I provided 'act2' as parameter for completeAction method in line #1 in my code snippet, but an appropriate route is not chosen.

Thank you in advance.

Shiva

0 Replies