Databases Reference
In-Depth Information
Updating the task flex fields
Once we have updated the task payload, we then need to update the corresponding
flex fields so that they remain synchronized with the order. We do this using an
Assign
activity in a similar way that we used to set the flex fields when creating the
task in our
OrderFulfillment
process.
Updating the task outcome
Finally we need to set the task outcome for the current step (this is effectively the
same as specifying a task action through the worklist application). In our case, we
have defined two potential outcomes:
COMPLETED
or
ABORTED
.
For
setShippingDetails
(as with all of our operations), we want to set the task
outcome to
COMPLETED
, note this won't actually complete the task, rather it completes
the current assignment, and in our case, as all our routing policies are single
approver, it will complete the current step in the workflow and move the task
on to the next step. Only once the final step is completed will the task complete
and control be returned to the
OrderFulfillment
BPEL process.
To set the task outcome, we only need to set the
outcome
element (located
in the task
systemAttributes
element) to
COMPLETED
. However, it isn't
quite that straightforward; if you look at the actual task data returned by the
getTaskDetailsByNumber
operation, the
outcome
element isn't present.
Thus if we use a standard
copy
operation to try and assign a value to this element,
we will get an XPath exception.
Instead, what we need to do is create the
outcome
element and its associated value
and append it to the
systemAttributes
element. To do this within the
Assign
activity, use an
Append Operation
, as shown in the following screenshot: