Trap.apex

  • Docs
  • Tutorials
Docs Menu
  • Trigger Handlers
  • Trigger Execution
    • Bulk Objects
    • Functions
    • Data Sharing
  • Trigger Controller

Bulk Objects Guide

Bulk Objects

Bulk Objects

Bulk objects help us manage the data in the trigger context.

Here is how we typically use the bulk objects.

Trap.BulkObject bo = new Trap.BulkObject();
bo.newStream
    .filter(new CustomFilterFunc())
    .subscribe(Trap.F.updateField.apply('Subject', 'New subject'));

for(Case c : caseList) {
    bo.newStream.next(c);
}

We can see that we don't necessarily need to use bulk objects inside triggers - they can be used standalone.

Fundamentally a bulk object is a container with two streams(old stream and new stream) and one shared data, which we will see later.

Data Streams

Bulk objects contain two streams:

  • oldStream This stream contains all the data from the old list in the trigger context.

  • newStream This stream contains all the data from the new list in the trigger context.

Contribute on Github! Edit this section.