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.
About this task
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");
}
}
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15