IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Developing client applications for BPEL processes and tasks > Developing EJB client applications > Developing applications for human tasks

Analyzing the results of a task

A to-do task (also known as a participating task in the API) or a collaboration task (also known as a human task in the API) runs asynchronously. If a reply handler is specified when the task starts, the output message is automatically returned when the task completes. If a reply handler is not specified, the message must be retrieved explicitly.

The results of the task are stored in the database only if the task template from which the task instance was derived does not specify automatic deletion of the derived task instances.


Procedure

Analyze the results of the task.

The example shows how to check the order number of a successfully completed task.

FilterOptions fo = new FilterOptions();
fo.setSelectedAttributes("TKIID");
fo.setQueryCondition("NAME='CustomerOrder' AND STATE=STATE_FINISHED");
EntityResultSet result = task.queryEntities("TASK", fo, null, null);

if (result.getEntities().size() > 0)
{
  Entity entity = (Entity) result.getEntities().get(0);
  TKIID tkiid = (TKIID) entity.getAttributeValue("TKIID");
  ClientObjectWrapper output = task.getOutputMessage(tkiid);
  DataObject myOutput = null;
  if ( output.getObject() != null && output.getObject() instanceof DataObject)
  {
     myOutput  = (DataObject)output.getObject();
     int order = myOutput.getInt("OrderNo");
  } }

Developing applications for human tasks


Related concepts:
Business Process Choreographer EJB query API