fferpcore.PluggableTriggerApiglobal with sharing class PluggableTriggerApi Provides interfaces that can be used to create plugins to be executed during the trigger of objects shared between multiple packages. Unlike creating multiple triggers, multiple plugins will be called in a defined order. Sample Code
fferpcore.PluggableTriggerApi.Pluginglobal interface Plugin Interface that plugins should implement. The objects being processed by the trigger should be stored on instances implementing this interface. Methods
onBeforeInsertvoid onBeforeInsert() Override this to perform processing during the before insert phase. onBeforeUpdatevoid onBeforeUpdate(Map<Id, SObject> existingRecords) Override this to perform processing during the before update phase. Input Parameters
onBeforeDeletevoid onBeforeDelete() Override this to perform processing during the before delete phase. onAfterInsertvoid onAfterInsert() Override this to perform processing during the after insert phase. onAfterUpdatevoid onAfterUpdate(Map<Id, SObject> existingRecords) Override this to perform processing during the after update phase. Input Parameters
onAfterDeletevoid onAfterDelete() Override this to perform processing during the after delete phase. onAfterUndeletevoid onAfterUndelete() Override this to perform processing during the after undelete phase. fferpcore.PluggableTriggerApi.PluginConstructorglobal interface PluginConstructor Constructs a plugin during a particular trigger execution. This is responsible for deciding whether a plugin is appropriate to the current trigger, and passing trigger context to the plugin being created. Methods
sObjectTypeSchema.SObjectType sObjectType() Used to select only plugins that are relevant to the records in the trigger. Return ValueThe sobject type that this plugin should be applied to. constructPluggableTriggerApi.Plugin construct(List<SObject> objects, fferpcore.PluggableTriggerApi.Context triggerContext) Called at the start of the trigger execution to construct plugins that will be applied. Input Parameters
Return ValueA plugin that will operate on the given sobjects when called. fferpcore.PluggableTriggerApi.Contextglobal virtual with sharing class Context Additional information regarding the trigger context that the plugin is being called in. Currently unused, but in place for later expansion. |