Data Sharing
Bulk objects help us manage the data shared inside. The basic idea is that you run a function, get the data and store it in the bulk object. The process, for the same piece of data, will only be triggered once. And then you can load the data from the bulk object in whatever way you like.
Below are methods to access the data:
Method | Description |
---|---|
Object getData(String) | Get the data |
Trap.BulkObject setData(String, Object) | Set the data |
Boolean containsData(String) | Check if the data is contained |
Example:
// ...
List accounts = [ SELECT Id FROM Account WHERE Id IN = : ids ];
bulkObj.setData('Accounts', accounts);
// ...
accounts = (List)bulkObj.getData('Accounts');