A shared business object (BAW 8.6.0 / 18.0+) is a business object type whose instances are stored once in the database and referenced by id from every process, task and service that uses them - instead of being copied into each execution context by data mapping. Mark the type in the business object editor: Shared = true; every variable of that type then holds a reference.
- Behaviour: two activities running in parallel that read tw.local.order (shared) see the same object; a change in one is visible to the other after save (last writer wins per field set); a linked process or a called service does not get a copy but the reference.
- Why: large objects no longer bloat execution contexts and instance migration; parallel work on the same data no longer needs merge scripts; reports can query the shared object storage tables directly.
- Costs: every access is a database read (lazy), so hot loops over a shared list are slower; the object must be saved by the system (automatic at the end of the step); versions are not kept (no history), and coaches work on a local copy until the task is submitted.
// creating and using a shared BO in a service flow
tw.local.order = new tw.object.Order(); // Order marked "Shared" in the BO editor
tw.local.order.number = "ORD-42";
tw.local.order.lines = new tw.object.listOf.OrderLine();
// pass it to a linked process / another activity: only the reference travels; both see updates after each step
Use shared objects for the central "case file" of a process (order, claim, application) that many steps touch; keep small, step-local data as normal objects. On CP4BA / Workflow Process Service shared business objects are supported the same way.
References