Updates to entity data
The abstract WorkQueueBase.processWorkItem
method does not have a bundle to manage database transactions related
to targeted units of work. A bundle does exist at the time PolicyCenter calls your custom processWorkItem method, but PolicyCenter uses that bundle for
updates to the work item. To modify entity data, you must create a bundle
using the Transaction.runWithNewBundle
API in your custom work queue class.
The following example code uses the runWithNewBundle transaction method
to update the EscalationDate
on the Activity instance
from the work items that is processes.
uses gw.transaction.Transaction
...
override function processWorkItem (WorkItem : StandardWorkItem): void {
// Extract the unit of work: an Activity instance
var activity = extractTarget(WorkItem)
// Update the activity escalation date
Transaction.runWithNewBundle( \ bundle -> {
activity = bundle.add(activity) // add the activity to the new bundle
activity.EscalationDate = java.util.Date.Today } ) // update the escalation date
return
}
See also
