A common CRM development request is for an automatic cost roll-up from one entity to its parent entity. For example: totalling all Detail costs that belong to a particular Project whenever a Detail is created, updated, or deleted.
The key to this plug-in is registering 3 steps for the Detail entity: Create, Update, and Delete. Each step would have an Image, but the Create and Update steps would use a Post-Image of the entity (after the record has been changed), and the Delete step would use a Pre-Image (before the record is deleted).
Since the Image contains the fields of the record at the time it was captured, it is used to get the ID of the parent record. Child records can then be queried for this particular parent, the costs totalled, and the parent record updated.
This approach can be used to roll-up multiple levels of costs. For example, a Customer may have multiple Events, and each Event may have multiple Expenses. The plug-in that totals the Expense costs would update the Event record, which would then trigger the Update step of another plug-in to total all Event costs for the Customer.