diff --git a/docs/Trigger-Actions-Framework/FinalizerHandler.md b/docs/Trigger-Actions-Framework/FinalizerHandler.md deleted file mode 100644 index 28bc750..0000000 --- a/docs/Trigger-Actions-Framework/FinalizerHandler.md +++ /dev/null @@ -1,84 +0,0 @@ -# virtual FinalizerHandler - -The `FinalizerHandler` class is a utility class that handles the execution of dynamic finalizers. -Finalizers are classes that implement the `TriggerAction.DmlFinalizer` interface and are defined in Custom Metadata. -Finalizers can be used to perform custom actions after all DML operations have completed. -The `FinalizerHandler` class provides the following functionality: -- A way to bypass the execution of specific finalizers. -- A way to check if a specific finalizer is bypassed. -- A way to clear all bypasses. -- A way to handle dynamic finalizers. ---- -To use the `FinalizerHandler` class, you must first create a Custom Metadata type called `DML_Finalizer__mdt`. -The `DML_Finalizer__mdt` Custom Metadata type must have the following fields: -- `Apex_Class_Name__c`: The name of the Apex class that implements the finalizer. -- `Order__c`: The order in which the finalizer should be executed. -- `Bypass_Execution__c`: A flag that indicates whether or not the finalizer should be bypassed. -- `Bypass_Permission__c`: The permission required to bypass the finalizer. -- `Required_Permission__c`: The permission required to execute the finalizer. ---- -Once you have created the `DML_Finalizer__mdt` Custom Metadata type, you can create finalizers by creating records -in the `DML_Finalizer__mdt` object. -To bypass the execution of a specific finalizer, you can call the `bypass` method of the `FinalizerHandler` class. -To check if a specific finalizer is bypassed, you can call the `isBypassed` method of the `FinalizerHandler` class. -To clear all bypasses, you can call the `clearAllBypasses` method of the `FinalizerHandler` class. -To handle dynamic finalizers, you can call the `handleDynamicFinalizers` method of the `FinalizerHandler` class. -The `handleDynamicFinalizers` method will instantiate and execute all finalizers that are not bypassed. - - -**Group** Trigger Actions Framework - -## Methods -### `public static void bypass(String finalizer)` - -Bypass the execution of a specific finalizer. - -#### Parameters - -|Param|Description| -|---|---| -|`finalizer`|The name of the finalizer to bypass.| - -### `public static void clearBypass(String finalizer)` - -Clear the bypass for a specific finalizer. - -#### Parameters - -|Param|Description| -|---|---| -|`finalizer`|The name of the finalizer to clear the bypass for.| - -### `public static Boolean isBypassed(String finalizer)` - -Check if a specific finalizer is bypassed. - -#### Parameters - -|Param|Description| -|---|---| -|`finalizer`|The name of the finalizer to check.| - -#### Returns - -|Type|Description| -|---|---| -|`Boolean`|True if the finalizer is bypassed, false otherwise.| - -### `public static void clearAllBypasses()` - -Clear all bypasses. - -### `public virtual void handleDynamicFinalizers()` - -Handle dynamic finalizers.nstantiates and executes finalizers based on metadata. - ---- -## Classes -### Context - -Context to be passed to the implementation's `.execute` methodis object's definition is empty. We are establishing the interface -to include the context to help future-proof the interface's specifications. - - ---- diff --git a/docs/Trigger-Actions-Framework/FlowChangeEventHeader.md b/docs/Trigger-Actions-Framework/FlowChangeEventHeader.md deleted file mode 100644 index b333aea..0000000 --- a/docs/Trigger-Actions-Framework/FlowChangeEventHeader.md +++ /dev/null @@ -1,114 +0,0 @@ -# FlowChangeEventHeader - -A flow-accessible version of the ChangeEventHeader class for use in -a flow handler of a change data capture event. - - -**Group** Trigger Actions Framework - - -**See** [https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_event_fields_header.htm](https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_event_fields_header.htm) - -## Constructors -### `public FlowChangeEventHeader(EventBus header)` - -Constructor that takes an `EventBus.ChangeEventHeader` object and populates the properties of this object with the values from the `EventBus.ChangeEventHeader` object. - -#### Parameters - -|Param|Description| -|---|---| -|`header`|The `EventBus.ChangeEventHeader` object to populate the properties of this object with.| - ---- -## Fields - -### `public changeOrigin` → `String` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public changeType` → `String` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public changedFields` → `List` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public commitNumber` → `Long` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public commitTimestamp` → `Long` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public commitUser` → `String` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public diffFields` → `List` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public entityName` → `String` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public nulledFields` → `List` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public recordIds` → `List` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public sequenceNumber` → `Integer` - -`INVOCABLEVARIABLE` -`AURAENABLED` - -### `public transactionKey` → `String` - -`INVOCABLEVARIABLE` -`AURAENABLED` - ---- -## Methods -### `public Boolean equals(Object obj)` - -Compares this `FlowChangeEventHeader` object to another object. - -#### Parameters - -|Param|Description| -|---|---| -|`obj`|The object to compare this `FlowChangeEventHeader` object to.| - -#### Returns - -|Type|Description| -|---|---| -|`Boolean`|`true` if the objects are equal, `false` otherwise.| - -### `public Integer hashCode()` - -Returns a hash code value for this `FlowChangeEventHeader` object. - -#### Returns - -|Type|Description| -|---|---| -|`Integer`|A hash code value for this `FlowChangeEventHeader` object.| - ---- diff --git a/docs/Trigger-Actions-Framework/MetadataTriggerHandler.md b/docs/Trigger-Actions-Framework/MetadataTriggerHandler.md deleted file mode 100644 index 53e572b..0000000 --- a/docs/Trigger-Actions-Framework/MetadataTriggerHandler.md +++ /dev/null @@ -1,234 +0,0 @@ -# MetadataTriggerHandler - -`SUPPRESSWARNINGS` - -The `MetadataTriggerHandler` class is a trigger handler that executes Trigger -Actions defined in Custom Metadata. -This class implements the `TriggerAction` interface for all supported Trigger Operations: -- `BeforeInsert` -- `AfterInsert` -- `BeforeUpdate` -- `AfterUpdate` -- `BeforeDelete` -- `AfterDelete` -- `AfterUndelete` ---- -The `MetadataTriggerHandler` class reads from the `Trigger_Action__mdt` Custom Metadata type to -define Trigger Actions. -Each Trigger Action must specify the following information: -- `Apex_Class_Name__c`: The name of the Apex class that implements the Trigger Action. -- `Order__c`: The order in which the Trigger Action should be executed. -- `Flow_Name__c`: The name of the Flow to execute (optional). -- `Bypass_Permission__c`: The permission required to bypass the Trigger Action (optional). -- `Required_Permission__c`: The permission required to execute the Trigger Action (optional). -- `Allow_Flow_Recursion__c`: Whether or not to allow the Flow to recurse (optional). ---- -The `MetadataTriggerHandler` class also uses the `sObject_Trigger_Setting__mdt` Custom Metadata type to define -Trigger Action settings for specific sObjects. -Each sObject Trigger Setting must specify the following information: -- `Bypass_Permission__c`: The permission required to bypass the Trigger Action for the specified sObject (optional). -- `Required_Permission__c`: The permission required to execute the Trigger Action for the specified sObject (optional). ---- -To use the `MetadataTriggerHandler` class, you must create a Trigger on the desired sObject and specify the - `MetadataTriggerHandler` class as the handler. -You can then define Trigger Actions and sObject Trigger Settings in Custom Metadata to control the behavior of the Trigger. -**Example:** -``` -trigger AccountTrigger on Account ( - before insert, - after insert, - before update, - after update, - before delete, - after delete, - after undelete -) { - new MetadataTriggerHandler.execute(); -} -``` -This example will execute all Trigger Actions defined in Custom Metadata for the `Account` sObject. - - -**Inheritance** - -[TriggerBase](/Trigger-Actions-Framework/TriggerBase.md) - > -MetadataTriggerHandler - - -**Implemented types** - -[TriggerAction.BeforeInsert](TriggerAction.BeforeInsert) -, -[TriggerAction.AfterInsert](TriggerAction.AfterInsert) -, -[TriggerAction.BeforeUpdate](TriggerAction.BeforeUpdate) -, -[TriggerAction.AfterUpdate](TriggerAction.AfterUpdate) -, -[TriggerAction.BeforeDelete](TriggerAction.BeforeDelete) -, -[TriggerAction.AfterDelete](TriggerAction.AfterDelete) -, -[TriggerAction.AfterUndelete](TriggerAction.AfterUndelete) - - -**Group** Trigger Actions Framework - -## Properties - -### `public idToNumberOfTimesSeenAfterUpdate` → `Map` - -*Inherited* - -This method returns a map of the IDs of the records that have been seen in the `AFTER_UPDATE` context to the number of times they have been seen. - -### `public idToNumberOfTimesSeenBeforeUpdate` → `Map` - -*Inherited* - -This method returns a map of the IDs of the records that have been seen in the `BEFORE_UPDATE` context to the number of times they have been seen. - ---- -## Methods -### `public static void bypass(String actionName)` - -Bypass the execution of a Trigger Action. - -#### Parameters - -|Param|Description| -|---|---| -|`actionName`|The name of the Trigger Action to bypass.| - -### `public static void clearBypass(String actionName)` - -Clear the bypass for a Trigger Action. - -#### Parameters - -|Param|Description| -|---|---| -|`actionName`|The name of the Trigger Action to clear the bypass for.| - -### `public static Boolean isBypassed(String actionName)` - -Check if a Trigger Action is bypassed. - -#### Parameters - -|Param|Description| -|---|---| -|`actionName`|The name of the Trigger Action to check.| - -#### Returns - -|Type|Description| -|---|---| -|`Boolean`|True if the Trigger Action is bypassed, false otherwise.| - -### `public static void clearAllBypasses()` - -Clear all bypasses for Trigger Actions. - -### `public void beforeInsert(List newList)` - -Execute the Before Insert Trigger Actions. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records being inserted.| - -### `public void afterInsert(List newList)` - -Execute the After Insert Trigger Actions. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that were inserted.| - -### `public void beforeUpdate(List newList, List oldList)` - -Execute the Before Update Trigger Actions. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of updated records.| -|`oldList`|The list of old records before the update.| - -### `public void afterUpdate(List newList, List oldList)` - -Execute the After Update Trigger Actions. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of updated records.| -|`oldList`|The list of old records before the update.| - -### `public void beforeDelete(List oldList)` - -Execute the Before Delete Trigger Actions. - -#### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of records being deleted.| - -### `public void afterDelete(List oldList)` - -Execute the After Delete Trigger Actions. - -#### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of records that were deleted.| - -### `public void afterUndelete(List newList)` - -Execute the After Undelete Trigger Actions. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of records that were undeleted.| - -### `public static void offsetExistingDmlRows()` - -*Inherited* - - -This method offsets the number of existing DML rows. - -### `public static void waitToFinalize()` - -*Inherited* - - -This method waits to finalize the DML operation. - -### `public static void nowFinalize()` - -*Inherited* - - -This method now finalizes the DML operation. - -### `public void run()` - -*Inherited* - - -This method runs the trigger handler. - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerAction.md b/docs/Trigger-Actions-Framework/TriggerAction.md deleted file mode 100644 index f5171e3..0000000 --- a/docs/Trigger-Actions-Framework/TriggerAction.md +++ /dev/null @@ -1,164 +0,0 @@ -# TriggerAction - -`SUPPRESSWARNINGS` - -The `TriggerAction` class defines the interfaces that should be implemented by Trigger Actions. -Trigger Actions are classes that define the logic that should be executed before or after a DML operation on a record. -The `TriggerAction` class defines the following interfaces: -- `BeforeInsert`: This interface defines the logic that should be executed before a new record is inserted. -- `AfterInsert`: This interface defines the logic that should be executed after a new record is inserted. -- `BeforeUpdate`: This interface defines the logic that should be executed before a record is updated. -- `AfterUpdate`: This interface defines the logic that should be executed after a record is updated. -- `BeforeDelete`: This interface defines the logic that should be executed before a record is deleted. -- `AfterDelete`: This interface defines the logic that should be executed after a record is deleted. -- `AfterUndelete`: This interface defines the logic that should be executed after a record is undeleted. -- `DmlFinalizer`: This interface defines the logic that should be executed after all DML operations have completed. ---- -To implement a Trigger Action, you must create a class that implements one or more of the `TriggerAction` interfaces. -The class must also be annotated with the `@AuraEnabled` annotation. -Once you have created a Trigger Action class, you can register it with the `TriggerActionRegistry` class. -The `TriggerActionRegistry` class is responsible for managing the execution of Trigger Actions. - - -**Group** Trigger Actions Framework - -## Interfaces -### AfterDelete - -This interface defines the logic that should be executed after a record is deleted. - -#### Methods -##### `public void afterDelete(List<SObject> oldList)` - -This method is called after a record is deleted. - -###### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of old records that were deleted.| - ---- - -### AfterInsert - -This interface defines the logic that should be executed after a new record is inserted. - -#### Methods -##### `public void afterInsert(List<SObject> newList)` - -This method is called after a new record is inserted. - -###### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that were inserted.| - ---- - -### AfterUndelete - -This interface defines the logic that should be executed after a record is undeleted. - -#### Methods -##### `public void afterUndelete(List<SObject> newList)` - -This method is called after a record is undeleted. - -###### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that were undeleted.| - ---- - -### AfterUpdate - -This interface defines the logic that should be executed after a record is updated. - -#### Methods -##### `public void afterUpdate(List<SObject> newList, List<SObject> oldList)` - -This method is called after a record is updated. - -###### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that were updated.| -|`oldList`|The list of old records that were updated.| - ---- - -### BeforeDelete - -This interface defines the logic that should be executed before a record is deleted. - -#### Methods -##### `public void beforeDelete(List<SObject> oldList)` - -This method is called before a record is deleted. - -###### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of old records that are being deleted.| - ---- - -### BeforeInsert - -This interface defines the logic that should be executed before -a new record is inserted. - -#### Methods -##### `public void beforeInsert(List<SObject> newList)` - -This method is called before a new record is inserted. - -###### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that are being inserted.| - ---- - -### BeforeUpdate - -This interface defines the logic that should be executed before a record is updated. - -#### Methods -##### `public void beforeUpdate(List<SObject> newList, List<SObject> oldList)` - -This method is called before a record is updated. - -###### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that are being updated.| -|`oldList`|The list of old records that are being updated.| - ---- - -### DmlFinalizer - -This interface defines the logic that should be executed after all DML operations have completed. - -#### Methods -##### `public void execute(FinalizerHandler context)` - -This method is called after all DML operations have completed. - -###### Parameters - -|Param|Description| -|---|---| -|`context`|The context of the finalizer.| - ---- - diff --git a/docs/Trigger-Actions-Framework/TriggerActionConstants.md b/docs/Trigger-Actions-Framework/TriggerActionConstants.md deleted file mode 100644 index 0b96ef8..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionConstants.md +++ /dev/null @@ -1,34 +0,0 @@ -# TriggerActionConstants - -This class contains constants used by the TriggerAction framework. - - -**Group** Trigger Actions Framework - -## Fields - -### `public APEX_STRING` → `String` - - -### `public FLOW_STRING` → `String` - - -### `public INVALID_FLOW_NAME` → `String` - - -### `public INVALID_TYPE` → `String` - - -### `public OBJECT_STRING` → `String` - - -### `public RECORD_PRIOR_VARIABLE` → `String` - - -### `public RECORD_VARIABLE` → `String` - - -### `public REQUEST_TYPES` → `Set` - - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlow.md b/docs/Trigger-Actions-Framework/TriggerActionFlow.md deleted file mode 100644 index ef31805..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionFlow.md +++ /dev/null @@ -1,166 +0,0 @@ -# virtual TriggerActionFlow - -`SUPPRESSWARNINGS` - -This class implements the TriggerAction interface and provides a framework for -executing Flows before or after the insert, update, delete, or undelete of records. - - -**Implemented types** - -[TriggerAction.BeforeInsert](TriggerAction.BeforeInsert) -, -[TriggerAction.AfterInsert](TriggerAction.AfterInsert) -, -[TriggerAction.BeforeUpdate](TriggerAction.BeforeUpdate) -, -[TriggerAction.AfterUpdate](TriggerAction.AfterUpdate) -, -[TriggerAction.BeforeDelete](TriggerAction.BeforeDelete) -, -[TriggerAction.AfterDelete](TriggerAction.AfterDelete) -, -[TriggerAction.AfterUndelete](TriggerAction.AfterUndelete) - - -**Group** Trigger Actions Framework - -## Fields - -### `public allowRecursion` → `Boolean` - - -### `public flowName` → `String` - - ---- -## Methods -### `public static void bypass(String flowName)` - -This method bypasses the execution of the Flow for the specified list of records. - -#### Parameters - -|Param|Description| -|---|---| -|`flowName`|The API name of the Flow to bypass.| - -### `public static void clearBypass(String flowName)` - -This method clears the bypass for the specified list of records. - -#### Parameters - -|Param|Description| -|---|---| -|`flowName`|The API name of the Flow to clear the bypass for.| - -### `public static Boolean isBypassed(String flowName)` - -This method checks if the Flow is bypassed for the specified list of records. - -#### Parameters - -|Param|Description| -|---|---| -|`flowName`|The API name of the Flow to check the bypass for.| - -#### Returns - -|Type|Description| -|---|---| -|`Boolean`|`true` if the Flow is bypassed for the specified list of records, `false` otherwise.| - -### `public static void clearAllBypasses()` - -This method clears all bypasses for all Flows. - -### `public static void validateType(String bypassType)` - -This method validates the specified bypass type. - -#### Parameters - -|Param|Description| -|---|---| -|`bypassType`|The bypass type to validate.| - -#### Throws - -|Exception|Description| -|---|---| -|`IllegalArgumentException`|if the bypass type is not valid.| - -### `public void beforeInsert(List newList)` - -This method executes the Flow for the specified list of records before the insert of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of records to execute the Flow for.| - -### `public void afterInsert(List newList)` - -This method executes the Flow for the specified list of records after the insert of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of records to execute the Flow for.| - -### `public void beforeUpdate(List newList, List oldList)` - -This method executes the Flow for the specified list of records before the update of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that are being updated.| -|`oldList`|The list of old records that are being updated.| - -### `public void afterUpdate(List newList, List oldList)` - -This method executes the Flow for the specified list of records after the update of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that are being updated.| -|`oldList`|The list of old records that are being updated.| - -### `public void beforeDelete(List oldList)` - -This method executes the Flow for the specified list of records before the delete of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of old records that are being deleted.| - -### `public void afterDelete(List oldList)` - -This method executes the Flow for the specified list of records after the delete of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of old records that are being deleted.| - -### `public void afterUndelete(List newList)` - -This method executes the Flow for the specified list of records before the undelete of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of records that are being restored.| - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlowAddError.md b/docs/Trigger-Actions-Framework/TriggerActionFlowAddError.md deleted file mode 100644 index fe6760b..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionFlowAddError.md +++ /dev/null @@ -1,50 +0,0 @@ -# TriggerActionFlowAddError - -This class provides an Invocable method that can be used to add an error to an sObject. -The Invocable method is called `addError` and it takes a list of `Request` objects as input. -Each `Request` object contains the following properties: -- `record`: The sObject to add the error to. -- `fieldName`: The API name of the field to add the error to. -- `errorMessage`: The error message to add. ---- -If the `fieldName` property is not specified, the error message will be added to the sObject without a field name. - - -**Group** Trigger Actions Framework - -## Methods -### `public static void addError(List requests)` - -`INVOCABLEMETHOD` - -This Invocable method adds an error to an sObject. - -#### Parameters - -|Param|Description| -|---|---| -|`requests`|A list of `Request` objects.| - ---- -## Classes -### Request - -This class represents a request to add an error to an sObject. - -#### Fields - -##### `public errorMessage` → `String` - -`INVOCABLEVARIABLE` - -##### `public fieldName` → `String` - -`INVOCABLEVARIABLE` - -##### `public record` → `SObject` - -`INVOCABLEVARIABLE` - ---- - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlowBypass.md b/docs/Trigger-Actions-Framework/TriggerActionFlowBypass.md deleted file mode 100644 index 1c9d183..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionFlowBypass.md +++ /dev/null @@ -1,45 +0,0 @@ -# TriggerActionFlowBypass - -`SUPPRESSWARNINGS` - -This class provides an Invocable method that can be used to bypass a trigger action flow, Apex class, or Object trigger. -The Invocable method is called `bypass` and it takes a list of `Request` objects as input. -Each `Request` object contains the following properties: -- `name`: The API name of the trigger action flow, Apex class, or Object trigger to bypass. -- `bypassType`: The type of bypass to perform. Valid values are `Apex`, `Flow`, or `Object`. - - -**Group** Trigger Actions Framework - -## Methods -### `public static void bypass(List requests)` - -`INVOCABLEMETHOD` - -This Invocable method bypasses a trigger action flow, Apex class, or Object trigger. - -#### Parameters - -|Param|Description| -|---|---| -|`requests`|A list of `Request` objects.| - ---- -## Classes -### Request - -This class represents a request to bypass a trigger action flow, Apex class, or Object trigger. - -#### Fields - -##### `public bypassType` → `String` - -`INVOCABLEVARIABLE` - -##### `public name` → `String` - -`INVOCABLEVARIABLE` - ---- - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlowBypassProcessor.md b/docs/Trigger-Actions-Framework/TriggerActionFlowBypassProcessor.md deleted file mode 100644 index be84baf..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionFlowBypassProcessor.md +++ /dev/null @@ -1,25 +0,0 @@ -# abstract TriggerActionFlowBypassProcessor - -This abstract class provides a framework for processing bypass requests for -trigger action flows, Apex classes, and Object triggers. -To use this class, you must first create a subclass that implements the -`processApexBypasses`, `processFlowBypasses`, and `processObjectBypasses` methods. -You can then use the `execute` method to process bypass requests for the specified - type of bypass. - - -**Group** Trigger Actions Framework - -## Methods -### `public void execute(String requestType, String requestName)` - -This method processes a bypass request for the specified type of bypass. - -#### Parameters - -|Param|Description| -|---|---| -|`requestType`|The type of bypass to process. Valid values are `Apex`, `Flow`, or `Object`.| -|`requestName`|The name of the trigger action flow, Apex class, or Object trigger to bypass.| - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlowChangeEvent.md b/docs/Trigger-Actions-Framework/TriggerActionFlowChangeEvent.md deleted file mode 100644 index 9fa8f11..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionFlowChangeEvent.md +++ /dev/null @@ -1,198 +0,0 @@ -# TriggerActionFlowChangeEvent - -The `TriggerActionFlowChangeEvent` class is a subclass of the `TriggerActionFlow` -class that is used to handle change events. -Change events are events that are generated when a record is created, updated, or deleted. -The `TriggerActionFlowChangeEvent` class provides the ability to access the change event header in the Flow interview. -To use the `TriggerActionFlowChangeEvent` class, you must first create a Flow that accepts a variable of -type `FlowChangeEventHeader`. -You can then use the `TriggerActionFlowChangeEvent` class to invoke the Flow and pass the change event header -as the input variable. - - -**Inheritance** - -[TriggerActionFlow](/Trigger-Actions-Framework/TriggerActionFlow.md) - > -TriggerActionFlowChangeEvent - - -**Group** Trigger Actions Framework - -## Fields - -### `public allowRecursion` → `Boolean` - -*Inherited* - -### `public flowName` → `String` - -*Inherited* - ---- -## Methods -### `public static void bypass(String flowName)` - -*Inherited* - - -This method bypasses the execution of the Flow for the specified list of records. - -#### Parameters - -|Param|Description| -|---|---| -|`flowName`|The API name of the Flow to bypass.| - -### `public static void clearBypass(String flowName)` - -*Inherited* - - -This method clears the bypass for the specified list of records. - -#### Parameters - -|Param|Description| -|---|---| -|`flowName`|The API name of the Flow to clear the bypass for.| - -### `public static Boolean isBypassed(String flowName)` - -*Inherited* - - -This method checks if the Flow is bypassed for the specified list of records. - -#### Parameters - -|Param|Description| -|---|---| -|`flowName`|The API name of the Flow to check the bypass for.| - -#### Returns - -|Type|Description| -|---|---| -|`Boolean`|`true` if the Flow is bypassed for the specified list of records, `false` otherwise.| - -### `public static void clearAllBypasses()` - -*Inherited* - - -This method clears all bypasses for all Flows. - -### `public static void validateType(String bypassType)` - -*Inherited* - - -This method validates the specified bypass type. - -#### Parameters - -|Param|Description| -|---|---| -|`bypassType`|The bypass type to validate.| - -#### Throws - -|Exception|Description| -|---|---| -|`IllegalArgumentException`|if the bypass type is not valid.| - -### `public void beforeInsert(List newList)` - -*Inherited* - - -This method executes the Flow for the specified list of records before the insert of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of records to execute the Flow for.| - -### `public void afterInsert(List newList)` - -*Inherited* - - -This method executes the Flow for the specified list of records after the insert of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of records to execute the Flow for.| - -### `public void beforeUpdate(List newList, List oldList)` - -*Inherited* - - -This method executes the Flow for the specified list of records before the update of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that are being updated.| -|`oldList`|The list of old records that are being updated.| - -### `public void afterUpdate(List newList, List oldList)` - -*Inherited* - - -This method executes the Flow for the specified list of records after the update of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of new records that are being updated.| -|`oldList`|The list of old records that are being updated.| - -### `public void beforeDelete(List oldList)` - -*Inherited* - - -This method executes the Flow for the specified list of records before the delete of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of old records that are being deleted.| - -### `public void afterDelete(List oldList)` - -*Inherited* - - -This method executes the Flow for the specified list of records after the delete of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`oldList`|The list of old records that are being deleted.| - -### `public void afterUndelete(List newList)` - -*Inherited* - - -This method executes the Flow for the specified list of records before the undelete of the records. - -#### Parameters - -|Param|Description| -|---|---| -|`newList`|The list of records that are being restored.| - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlowClearBypass.md b/docs/Trigger-Actions-Framework/TriggerActionFlowClearBypass.md deleted file mode 100644 index 73a7b46..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionFlowClearBypass.md +++ /dev/null @@ -1,51 +0,0 @@ -# TriggerActionFlowClearBypass - -`SUPPRESSWARNINGS` - -The `TriggerActionFlowClearBypass` class is a utility class that handles the clearing -of bypasses for objects, Apex actions, or Flow actions. -Bypasses are used to prevent the execution of specific Trigger Actions. -The `TriggerActionFlowClearBypass` class provides a way to clear the bypass for a specific object, Apex action, or Flow action. -To use the `TriggerActionFlowClearBypass` class, you must first create a list of the objects, Apex actions, or Flow actions that you want to clear the bypasses for. -You can then call the `clearBypass` method of the `TriggerActionFlowClearBypass` class and pass the list of objects, Apex actions, or Flow actions as the input parameter. -The `clearBypass` method will clear the bypass for the specified objects, Apex actions, or Flow actions. - - -**Group** Trigger Actions Framework - -## Methods -### `public static void clearBypass(List requests)` - -`INVOCABLEMETHOD` - -This method clears the bypass for the specified objects, Apex actions, or Flow actions. - -#### Parameters - -|Param|Description| -|---|---| -|`requests`|A list of the objects, Apex actions, or Flow actions to clear the bypasses for.| - ---- -## Classes -### Request - -The `Request` class is a class that represents a request to clear the bypass for a -specific object, Apex action, or Flow action. -To use the `Request` class, you must specify the following properties: -- `name`: The API name of the object, Apex action, or Flow action to clear the bypass for. -- `bypassType`: The type of bypass to clear. Valid values are `Apex`, `Flow`, or `Object`. - -#### Fields - -##### `public bypassType` → `String` - -`INVOCABLEVARIABLE` - -##### `public name` → `String` - -`INVOCABLEVARIABLE` - ---- - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlowIsBypassed.md b/docs/Trigger-Actions-Framework/TriggerActionFlowIsBypassed.md deleted file mode 100644 index f1c12bf..0000000 --- a/docs/Trigger-Actions-Framework/TriggerActionFlowIsBypassed.md +++ /dev/null @@ -1,60 +0,0 @@ -# TriggerActionFlowIsBypassed - -`SUPPRESSWARNINGS` - -The `TriggerActionFlowIsBypassed` class is a utility class that handles the checking of -bypasses for objects, Apex actions, or Flow actions. -Bypasses are used to prevent the execution of specific Trigger Actions. -The `TriggerActionFlowIsBypassed` class provides a way to check if the bypass is set -to `true` for a specific object, Apex action, or Flow action. -To use the `TriggerActionFlowIsBypassed` class, you must first create a list of the objects, -Apex actions, or Flow actions that you want to check the bypasses for. -You can then call the `isBypassed` method of the `TriggerActionFlowIsBypassed` class and -pass the list of objects, Apex actions, or Flow actions as the input parameter. -The `isBypassed` method will return a list of booleans indicating whether the bypass is set -to `true` for each of the specified objects, Apex actions, or Flow actions. - - -**Group** Trigger Actions Framework - -## Methods -### `public static List isBypassed(List requests)` - -`INVOCABLEMETHOD` - -This method checks if the bypass is set to `true` for the specified objects, Apex actions, or Flow actions. - -#### Parameters - -|Param|Description| -|---|---| -|`requests`|A list of the objects, Apex actions, or Flow actions to check the bypasses for.| - -#### Returns - -|Type|Description| -|---|---| -|`List`|A list of booleans indicating whether the bypass is set to `true` for each of the specified objects, Apex actions, or Flow actions.| - ---- -## Classes -### Request - -The `Request` class is a class that represents a request to check if the bypass is set to `true` for a specific object, Apex action, or Flow action. -To use the `Request` class, you must specify the following properties: -- `name`: The API name of the object, Apex action, or Flow action to check the bypass for. -- `bypassType`: The type of bypass to check. Valid values are `Apex`, `Flow`, or `Object`. - -#### Fields - -##### `public bypassType` → `String` - -`INVOCABLEVARIABLE` - -##### `public name` → `String` - -`INVOCABLEVARIABLE` - ---- - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerBase.md b/docs/Trigger-Actions-Framework/TriggerBase.md deleted file mode 100644 index 99551f7..0000000 --- a/docs/Trigger-Actions-Framework/TriggerBase.md +++ /dev/null @@ -1,92 +0,0 @@ -# virtual TriggerBase - -`SUPPRESSWARNINGS` - -The `TriggerBase` class is a base class for all trigger handlers. -Trigger handlers are classes that define the logic that should be executed before or after -a DML operation on a record. -The `TriggerBase` class provides the following functionality: -- A way to bypass the execution of specific trigger handlers. -- A way to check if a specific trigger handler is bypassed. -- A way to clear all bypasses. -- A way to offset the number of existing DML rows. -- A way to wait to finalize the DML operation. -- A way to now finalize the DML operation. ---- -To use the `TriggerBase` class, you must create a subclass that implements the `TriggerAction` interface. -The `TriggerAction` interface defines the methods that should be implemented by trigger actions. - - -**Group** Trigger Actions Framework - -## Properties - -### `public idToNumberOfTimesSeenAfterUpdate` → `Map` - - -This method returns a map of the IDs of the records that have been seen in the `AFTER_UPDATE` context to the number of times they have been seen. - -### `public idToNumberOfTimesSeenBeforeUpdate` → `Map` - - -This method returns a map of the IDs of the records that have been seen in the `BEFORE_UPDATE` context to the number of times they have been seen. - ---- -## Methods -### `public static void bypass(String sObjectName)` - -This method bypasses the execution of the specified object. - -#### Parameters - -|Param|Description| -|---|---| -|`sObjectName`|The API name of the object to bypass.| - -### `public static void clearBypass(String sObjectName)` - -This method clears the bypass for the specified object. - -#### Parameters - -|Param|Description| -|---|---| -|`sObjectName`|The API name of the object to clear the bypass for.| - -### `public static Boolean isBypassed(String sObjectName)` - -This method checks if the specified object is bypassed. - -#### Parameters - -|Param|Description| -|---|---| -|`sObjectName`|The API name of the object to check the bypass for.| - -#### Returns - -|Type|Description| -|---|---| -|`Boolean`|True if the object is bypassed, false otherwise.| - -### `public static void clearAllBypasses()` - -This method clears all bypasses. - -### `public static void offsetExistingDmlRows()` - -This method offsets the number of existing DML rows. - -### `public static void waitToFinalize()` - -This method waits to finalize the DML operation. - -### `public static void nowFinalize()` - -This method now finalizes the DML operation. - -### `public void run()` - -This method runs the trigger handler. - ---- diff --git a/docs/Trigger-Actions-Framework/TriggerTestUtility.md b/docs/Trigger-Actions-Framework/TriggerTestUtility.md deleted file mode 100644 index ea3b17a..0000000 --- a/docs/Trigger-Actions-Framework/TriggerTestUtility.md +++ /dev/null @@ -1,30 +0,0 @@ -# TriggerTestUtility - -`ISTEST` - -The `TriggerTestUtility` class is a utility class that provides helper methods for writing -Apex test classes for trigger handlers. -The `TriggerTestUtility` class provides the following helper methods: -- `getFakeId`: This method generates a fake ID for the specified sObject type. - - -**Group** Trigger Actions Framework - -## Methods -### `public static Id getFakeId(Schema sObjectType)` - -This method generates a fake ID for the specified sObject type. - -#### Parameters - -|Param|Description| -|---|---| -|`sObjectType`|The sObject type to generate a fake ID for.| - -#### Returns - -|Type|Description| -|---|---| -|`Id`|A fake ID for the specified sObject type.| - ---- diff --git a/docs/custom-objects/DML_Finalizer__mdt.md b/docs/custom-objects/DML_Finalizer__mdt.md new file mode 100644 index 0000000..0643cca --- /dev/null +++ b/docs/custom-objects/DML_Finalizer__mdt.md @@ -0,0 +1,69 @@ +# DML Finalizer + +## API Name +`DML_Finalizer__mdt` + +## Fields +### Apex Class Name +**Required** + +Enter the name of the Apex Class which defines the action to be taken + +**API Name** + +`Apex_Class_Name__c` + +**Type** + +*Text* + +--- +### Bypass Execution + +Set this to true to bypass this Trigger Action from being called + +**API Name** + +`Bypass_Execution__c` + +**Type** + +*Checkbox* + +--- +### Bypass Permission + +Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified. + +**API Name** + +`Bypass_Permission__c` + +**Type** + +*Text* + +--- +### Order +**Required** + +**API Name** + +`Order__c` + +**Type** + +*Number* + +--- +### Required Permission + +Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified. + +**API Name** + +`Required_Permission__c` + +**Type** + +*Text* \ No newline at end of file diff --git a/docs/custom-objects/Trigger_Action__mdt.md b/docs/custom-objects/Trigger_Action__mdt.md new file mode 100644 index 0000000..b57bca8 --- /dev/null +++ b/docs/custom-objects/Trigger_Action__mdt.md @@ -0,0 +1,210 @@ +# Trigger Action + +## API Name +`Trigger_Action__mdt` + +## Fields +### After Delete + +Enter the name of the sObject you want to have this action execute on during the after delete context + +**API Name** + +`After_Delete__c` + +**Type** + +*MetadataRelationship* + +--- +### After Insert + +Enter the name of the sObject you want to have this action execute on during the after insert context + +**API Name** + +`After_Insert__c` + +**Type** + +*MetadataRelationship* + +--- +### After Undelete + +Enter the name of the sObject you want to have this action execute on during the after undelete context + +**API Name** + +`After_Undelete__c` + +**Type** + +*MetadataRelationship* + +--- +### After Update + +Enter the name of the sObject you want to have this action execute on during the after update context + +**API Name** + +`After_Update__c` + +**Type** + +*MetadataRelationship* + +--- +### Allow Flow Recursion? + +Check this box to allow the flow to execute recursively + +**API Name** + +`Allow_Flow_Recursion__c` + +**Type** + +*Checkbox* + +--- +### Apex Class Name +**Required** + +Enter the name of the Apex Class which defines the action to be taken + +**API Name** + +`Apex_Class_Name__c` + +**Type** + +*Text* + +--- +### Before Delete + +Enter the name of the sObject you want to have this action execute on during the before delete context + +**API Name** + +`Before_Delete__c` + +**Type** + +*MetadataRelationship* + +--- +### Before Insert + +Enter the name of the sObject you want to have this action execute on during the before insert context + +**API Name** + +`Before_Insert__c` + +**Type** + +*MetadataRelationship* + +--- +### Before Update + +Enter the name of the sObject you want to have this action execute on during the before update context + +**API Name** + +`Before_Update__c` + +**Type** + +*MetadataRelationship* + +--- +### Bypass Execution + +Set this to true to bypass this Trigger Action from being called + +**API Name** + +`Bypass_Execution__c` + +**Type** + +*Checkbox* + +--- +### Bypass Permission + +Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified. + +**API Name** + +`Bypass_Permission__c` + +**Type** + +*Text* + +--- +### Description + +**API Name** + +`Description__c` + +**Type** + +*LongTextArea* + +--- +### Entry Criteria + +Formula which if evaluated to true for a given record during trigger processing, then this trigger action will be processed for that record. + +**API Name** + +`Entry_Criteria__c` + +**Type** + +*LongTextArea* + +--- +### Flow Name + +Enter the API name of the flow you would like to execute. + +**API Name** + +`Flow_Name__c` + +**Type** + +*Text* + +--- +### Order +**Required** + +**API Name** + +`Order__c` + +**Type** + +*Number* + +--- +### Required Permission + +Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified. + +**API Name** + +`Required_Permission__c` + +**Type** + +*Text* \ No newline at end of file diff --git a/docs/custom-objects/sObject_Trigger_Setting__mdt.md b/docs/custom-objects/sObject_Trigger_Setting__mdt.md new file mode 100644 index 0000000..5e8d402 --- /dev/null +++ b/docs/custom-objects/sObject_Trigger_Setting__mdt.md @@ -0,0 +1,85 @@ +# sObject Trigger Setting + +## API Name +`sObject_Trigger_Setting__mdt` + +## Fields +### Bypass Execution + +Set this to true to bypass all Trigger Actions from being called on this sObject + +**API Name** + +`Bypass_Execution__c` + +**Type** + +*Checkbox* + +--- +### Bypass Permission + +Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will be bypassed if the running user has the custom permission identified. + +**API Name** + +`Bypass_Permission__c` + +**Type** + +*Text* + +--- +### Object API Name +**Required** + +Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. + +**API Name** + +`Object_API_Name__c` + +**Type** + +*Text* + +--- +### Object Namespace + +Enter the namespace object for this trigger. + +**API Name** + +`Object_Namespace__c` + +**Type** + +*Text* + +--- +### Required Permission + +Optional. Enter the API name of a permission. If this field has a value, then the triggers on this object will only execute if the running user has the custom permission identified. + +**API Name** + +`Required_Permission__c` + +**Type** + +*Text* + +--- +### TriggerRecord Class Name + +Enter the API name of a global class which extends `TriggerRecord` and contains two global properties: `record` + and `recordPrior`. Both of these variables need to match the SObject type for this SObject + Trigger Setting record. + +**API Name** + +`TriggerRecord_Class_Name__c` + +**Type** + +*Text* \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..215b2d5 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,255 @@ +# Reference Guide + +## Custom Objects + +### [DML_Finalizer__mdt](custom-objects/DML_Finalizer__mdt.md) + +### [Trigger_Action__mdt](custom-objects/Trigger_Action__mdt.md) + +### [sObject_Trigger_Setting__mdt](custom-objects/sObject_Trigger_Setting__mdt.md) + +## Trigger Actions Framework + +### [FinalizerHandler](trigger-actions-framework/FinalizerHandler.md) + +The `FinalizerHandler` class is a utility class that handles the execution of dynamic finalizers. + +Finalizers are classes that implement the `TriggerAction.DmlFinalizer` interface and are defined in Custom Metadata. +Finalizers can be used to perform custom actions after all DML operations have completed. + +The `FinalizerHandler` class provides the following functionality: + +- A way to bypass the execution of specific finalizers. +- A way to check if a specific finalizer is bypassed. +- A way to clear all bypasses. +- A way to handle dynamic finalizers. +--- +To use the `FinalizerHandler` class, you must first create a Custom Metadata type called `DML_Finalizer__mdt` . +The `DML_Finalizer__mdt` Custom Metadata type must have the following fields: + +- `Apex_Class_Name__c` : The name of the Apex class that implements the finalizer. +- `Order__c` : The order in which the finalizer should be executed. +- `Bypass_Execution__c` : A flag that indicates whether or not the finalizer should be bypassed. +- `Bypass_Permission__c` : The permission required to bypass the finalizer. +- `Required_Permission__c` : The permission required to execute the finalizer. +--- +Once you have created the `DML_Finalizer__mdt` Custom Metadata type, you can create finalizers by creating records +in the `DML_Finalizer__mdt` object. + +To bypass the execution of a specific finalizer, you can call the `bypass` method of the `FinalizerHandler` class. +To check if a specific finalizer is bypassed, you can call the `isBypassed` method of the `FinalizerHandler` class. +To clear all bypasses, you can call the `clearAllBypasses` method of the `FinalizerHandler` class. + +To handle dynamic finalizers, you can call the `handleDynamicFinalizers` method of the `FinalizerHandler` class. +The `handleDynamicFinalizers` method will instantiate and execute all finalizers that are not bypassed. + +### [FlowChangeEventHeader](trigger-actions-framework/FlowChangeEventHeader.md) + +A flow-accessible version of the ChangeEventHeader class for use in +a flow handler of a change data capture event. + +### [MetadataTriggerHandler](trigger-actions-framework/MetadataTriggerHandler.md) + +The `MetadataTriggerHandler` class is a trigger handler that executes Trigger +Actions defined in Custom Metadata. + +This class implements the `TriggerAction` interface for all supported Trigger Operations: + +- `BeforeInsert` +- `AfterInsert` +- `BeforeUpdate` +- `AfterUpdate` +- `BeforeDelete` +- `AfterDelete` +- `AfterUndelete` +--- +The `MetadataTriggerHandler` class reads from the `Trigger_Action__mdt` Custom Metadata type to +define Trigger Actions. + +Each Trigger Action must specify the following information: + +- `Apex_Class_Name__c` : The name of the Apex class that implements the Trigger Action. +- `Order__c` : The order in which the Trigger Action should be executed. +- `Flow_Name__c` : The name of the Flow to execute (optional). +- `Bypass_Permission__c` : The permission required to bypass the Trigger Action (optional). +- `Required_Permission__c` : The permission required to execute the Trigger Action (optional). +- `Allow_Flow_Recursion__c` : Whether or not to allow the Flow to recurse (optional). +--- + +The `MetadataTriggerHandler` class also uses the `sObject_Trigger_Setting__mdt` Custom Metadata type to define +Trigger Action settings for specific sObjects. + +Each sObject Trigger Setting must specify the following information: + +- `Bypass_Permission__c` : The permission required to bypass the Trigger Action for the specified sObject (optional). +- `Required_Permission__c` : The permission required to execute the Trigger Action for the specified sObject (optional). +--- + +To use the `MetadataTriggerHandler` class, you must create a Trigger on the desired sObject and specify the + `MetadataTriggerHandler` class as the handler. +You can then define Trigger Actions and sObject Trigger Settings in Custom Metadata to control the behavior of the Trigger. + +**Example:** + +```apex +trigger AccountTrigger on Account ( + before insert, + after insert, + before update, + after update, + before delete, + after delete, + after undelete +) { + new MetadataTriggerHandler.execute(); +} +``` + + +This example will execute all Trigger Actions defined in Custom Metadata for the `Account` sObject. + +### [TriggerAction](trigger-actions-framework/TriggerAction.md) + +The `TriggerAction` class defines the interfaces that should be implemented by Trigger Actions. + +Trigger Actions are classes that define the logic that should be executed before or after a DML operation on a record. +The `TriggerAction` class defines the following interfaces: + +- `BeforeInsert` : This interface defines the logic that should be executed before a new record is inserted. +- `AfterInsert` : This interface defines the logic that should be executed after a new record is inserted. +- `BeforeUpdate` : This interface defines the logic that should be executed before a record is updated. +- `AfterUpdate` : This interface defines the logic that should be executed after a record is updated. +- `BeforeDelete` : This interface defines the logic that should be executed before a record is deleted. +- `AfterDelete` : This interface defines the logic that should be executed after a record is deleted. +- `AfterUndelete` : This interface defines the logic that should be executed after a record is undeleted. +- `DmlFinalizer` : This interface defines the logic that should be executed after all DML operations have completed. +--- +To implement a Trigger Action, you must create a class that implements one or more of the `TriggerAction` interfaces. + +### [TriggerActionConstants](trigger-actions-framework/TriggerActionConstants.md) + +This class contains constants used by the TriggerAction framework. + +### [TriggerActionFlow](trigger-actions-framework/TriggerActionFlow.md) + +This class implements the TriggerAction interface and provides a framework for +executing Flows before or after the insert, update, delete, or undelete of records. + +### [TriggerActionFlowAddError](trigger-actions-framework/TriggerActionFlowAddError.md) + +This class provides an Invocable method that can be used to add an error to an sObject. + +The Invocable method is called `addError` and it takes a list of `Request` objects as input. +Each `Request` object contains the following properties: + +- `record` : The sObject to add the error to. +- `fieldName` : The API name of the field to add the error to. +- `errorMessage` : The error message to add. + +--- + +If the `fieldName` property is not specified, the error message will be added to the sObject without a field name. + +### [TriggerActionFlowBypass](trigger-actions-framework/TriggerActionFlowBypass.md) + +This class provides an Invocable method that can be used to bypass a trigger action flow, Apex class, or Object trigger. + +The Invocable method is called `bypass` and it takes a list of `Request` objects as input. +Each `Request` object contains the following properties: + +- `name` : The API name of the trigger action flow, Apex class, or Object trigger to bypass. +- `bypassType` : The type of bypass to perform. Valid values are `Apex` , `Flow` , or `Object` . + +### [TriggerActionFlowBypassProcessor](trigger-actions-framework/TriggerActionFlowBypassProcessor.md) + +This abstract class provides a framework for processing bypass requests for +trigger action flows, Apex classes, and Object triggers. + +To use this class, you must first create a subclass that implements the + `processApexBypasses` , `processFlowBypasses` , and `processObjectBypasses` methods. +You can then use the `execute` method to process bypass requests for the specified +type of bypass. + +### [TriggerActionFlowChangeEvent](trigger-actions-framework/TriggerActionFlowChangeEvent.md) + +The `TriggerActionFlowChangeEvent` class is a subclass of the `TriggerActionFlow` +class that is used to handle change events. + +Change events are events that are generated when a record is created, updated, or deleted. +The `TriggerActionFlowChangeEvent` class provides the ability to access the change event header in the Flow interview. + +To use the `TriggerActionFlowChangeEvent` class, you must first create a Flow that accepts a variable of +type `FlowChangeEventHeader` . + +You can then use the `TriggerActionFlowChangeEvent` class to invoke the Flow and pass the change event header +as the input variable. + +### [TriggerActionFlowClearAllBypasses](trigger-actions-framework/TriggerActionFlowClearAllBypasses.md) + +The `TriggerActionFlowClearAllBypasses` class is a utility class that handles the +clearing of all bypasses for objects, Apex actions, or Flow actions. + +Bypasses are used to prevent the execution of specific Trigger Actions. +The `TriggerActionFlowClearAllBypasses` class provides a way to clear all bypasses for a specific object, Apex action, or Flow action. + +To use the `TriggerActionFlowClearAllBypasses` class, you must first create a list of the objects, Apex actions, or Flow actions that you want to clear the bypasses for. +You can then call the `clearAllBypasses` method of the `TriggerActionFlowClearAllBypasses` class and pass the list of objects, Apex actions, or Flow actions as the input parameter. + +The `clearAllBypasses` method will clear all bypasses for the specified objects, Apex actions, or Flow actions. + +### [TriggerActionFlowClearBypass](trigger-actions-framework/TriggerActionFlowClearBypass.md) + +The `TriggerActionFlowClearBypass` class is a utility class that handles the clearing +of bypasses for objects, Apex actions, or Flow actions. + +Bypasses are used to prevent the execution of specific Trigger Actions. +The `TriggerActionFlowClearBypass` class provides a way to clear the bypass for a specific object, Apex action, or Flow action. + +To use the `TriggerActionFlowClearBypass` class, you must first create a list of the objects, Apex actions, or Flow actions that you want to clear the bypasses for. +You can then call the `clearBypass` method of the `TriggerActionFlowClearBypass` class and pass the list of objects, Apex actions, or Flow actions as the input parameter. + +The `clearBypass` method will clear the bypass for the specified objects, Apex actions, or Flow actions. + +### [TriggerActionFlowIsBypassed](trigger-actions-framework/TriggerActionFlowIsBypassed.md) + +The `TriggerActionFlowIsBypassed` class is a utility class that handles the checking of +bypasses for objects, Apex actions, or Flow actions. + +Bypasses are used to prevent the execution of specific Trigger Actions. +The `TriggerActionFlowIsBypassed` class provides a way to check if the bypass is set +to `true` for a specific object, Apex action, or Flow action. + +To use the `TriggerActionFlowIsBypassed` class, you must first create a list of the objects, +Apex actions, or Flow actions that you want to check the bypasses for. +You can then call the `isBypassed` method of the `TriggerActionFlowIsBypassed` class and +pass the list of objects, Apex actions, or Flow actions as the input parameter. + +The `isBypassed` method will return a list of booleans indicating whether the bypass is set +to `true` for each of the specified objects, Apex actions, or Flow actions. + +### [TriggerBase](trigger-actions-framework/TriggerBase.md) + +The `TriggerBase` class is a base class for all trigger handlers. + +Trigger handlers are classes that define the logic that should be executed before or after +a DML operation on a record. +The `TriggerBase` class provides the following functionality: + +- A way to bypass the execution of specific trigger handlers. +- A way to check if a specific trigger handler is bypassed. +- A way to clear all bypasses. +- A way to offset the number of existing DML rows. +- A way to wait to finalize the DML operation. +- A way to now finalize the DML operation. +--- +To use the `TriggerBase` class, you must create a subclass that implements the `TriggerAction` interface. +The `TriggerAction` interface defines the methods that should be implemented by trigger actions. + +### [TriggerTestUtility](trigger-actions-framework/TriggerTestUtility.md) + +The `TriggerTestUtility` class is a utility class that provides helper methods for writing +Apex test classes for trigger handlers. + +The `TriggerTestUtility` class provides the following helper methods: + +- `getFakeId` : This method generates a fake ID for the specified sObject type. \ No newline at end of file diff --git a/docs/trigger-actions-framework/FinalizerHandler.md b/docs/trigger-actions-framework/FinalizerHandler.md new file mode 100644 index 0000000..610949f --- /dev/null +++ b/docs/trigger-actions-framework/FinalizerHandler.md @@ -0,0 +1,127 @@ +# FinalizerHandler Class +`virtual` + +The `FinalizerHandler` class is a utility class that handles the execution of dynamic finalizers. + +Finalizers are classes that implement the `TriggerAction.DmlFinalizer` interface and are defined in Custom Metadata. +Finalizers can be used to perform custom actions after all DML operations have completed. + +The `FinalizerHandler` class provides the following functionality: + +- A way to bypass the execution of specific finalizers. +- A way to check if a specific finalizer is bypassed. +- A way to clear all bypasses. +- A way to handle dynamic finalizers. +--- +To use the `FinalizerHandler` class, you must first create a Custom Metadata type called `DML_Finalizer__mdt` . +The `DML_Finalizer__mdt` Custom Metadata type must have the following fields: + +- `Apex_Class_Name__c` : The name of the Apex class that implements the finalizer. +- `Order__c` : The order in which the finalizer should be executed. +- `Bypass_Execution__c` : A flag that indicates whether or not the finalizer should be bypassed. +- `Bypass_Permission__c` : The permission required to bypass the finalizer. +- `Required_Permission__c` : The permission required to execute the finalizer. +--- +Once you have created the `DML_Finalizer__mdt` Custom Metadata type, you can create finalizers by creating records +in the `DML_Finalizer__mdt` object. + +To bypass the execution of a specific finalizer, you can call the `bypass` method of the `FinalizerHandler` class. +To check if a specific finalizer is bypassed, you can call the `isBypassed` method of the `FinalizerHandler` class. +To clear all bypasses, you can call the `clearAllBypasses` method of the `FinalizerHandler` class. + +To handle dynamic finalizers, you can call the `handleDynamicFinalizers` method of the `FinalizerHandler` class. +The `handleDynamicFinalizers` method will instantiate and execute all finalizers that are not bypassed. + +**Group** Trigger Actions Framework + +## Methods +### `bypass(finalizer)` + +Bypass the execution of a specific finalizer. + +#### Signature +```apex +public static void bypass(String finalizer) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| finalizer | String | The name of the finalizer to bypass. | + +#### Return Type +**void** + +--- + +### `clearBypass(finalizer)` + +Clear the bypass for a specific finalizer. + +#### Signature +```apex +public static void clearBypass(String finalizer) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| finalizer | String | The name of the finalizer to clear the bypass for. | + +#### Return Type +**void** + +--- + +### `isBypassed(finalizer)` + +Check if a specific finalizer is bypassed. + +#### Signature +```apex +public static Boolean isBypassed(String finalizer) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| finalizer | String | The name of the finalizer to check. | + +#### Return Type +**Boolean** + +True if the finalizer is bypassed, false otherwise. + +--- + +### `clearAllBypasses()` + +Clear all bypasses. + +#### Signature +```apex +public static void clearAllBypasses() +``` + +#### Return Type +**void** + +--- + +### `handleDynamicFinalizers()` + +Handle dynamic finalizers.nstantiates and executes finalizers based on metadata. + +#### Signature +```apex +public virtual void handleDynamicFinalizers() +``` + +#### Return Type +**void** + +## Classes +### Context Class + +Context to be passed to the implementation's `.execute` methodis object's definition is empty. We are establishing the interface +to include the context to help future-proof the interface's specifications. \ No newline at end of file diff --git a/docs/trigger-actions-framework/FlowChangeEventHeader.md b/docs/trigger-actions-framework/FlowChangeEventHeader.md new file mode 100644 index 0000000..0529726 --- /dev/null +++ b/docs/trigger-actions-framework/FlowChangeEventHeader.md @@ -0,0 +1,239 @@ +# FlowChangeEventHeader Class + +A flow-accessible version of the ChangeEventHeader class for use in +a flow handler of a change data capture event. + +**Group** Trigger Actions Framework + +**See** https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_event_fields_header.htm + +## Fields +### `entityName` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public entityName +``` + +#### Type +String + +--- + +### `recordIds` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public recordIds +``` + +#### Type +List<String> + +--- + +### `changeType` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public changeType +``` + +#### Type +String + +--- + +### `changeOrigin` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public changeOrigin +``` + +#### Type +String + +--- + +### `transactionKey` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public transactionKey +``` + +#### Type +String + +--- + +### `sequenceNumber` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public sequenceNumber +``` + +#### Type +Integer + +--- + +### `commitTimestamp` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public commitTimestamp +``` + +#### Type +Long + +--- + +### `commitUser` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public commitUser +``` + +#### Type +String + +--- + +### `commitNumber` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public commitNumber +``` + +#### Type +Long + +--- + +### `nulledFields` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public nulledFields +``` + +#### Type +List<String> + +--- + +### `diffFields` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public diffFields +``` + +#### Type +List<String> + +--- + +### `changedFields` + +`INVOCABLEVARIABLE` +`AURAENABLED` + +#### Signature +```apex +public changedFields +``` + +#### Type +List<String> + +## Constructors +### `FlowChangeEventHeader(header)` + +Constructor that takes an `EventBus.ChangeEventHeader` object and populates +the properties of this object with the values from the `EventBus.ChangeEventHeader` object. + +#### Signature +```apex +public FlowChangeEventHeader(EventBus.ChangeEventHeader header) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| header | EventBus.ChangeEventHeader | The ,[object Object], object to populate the properties of this object with. | + +## Methods +### `equals(obj)` + +Compares this `FlowChangeEventHeader` object to another object. + +#### Signature +```apex +public Boolean equals(Object obj) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| obj | Object | The object to compare this `FlowChangeEventHeader` object to. | + +#### Return Type +**Boolean** + +,[object Object], if the objects are equal, ,[object Object], otherwise. + +--- + +### `hashCode()` + +Returns a hash code value for this `FlowChangeEventHeader` object. + +#### Signature +```apex +public Integer hashCode() +``` + +#### Return Type +**Integer** + +A hash code value for this ,[object Object], object. \ No newline at end of file diff --git a/docs/trigger-actions-framework/MetadataTriggerHandler.md b/docs/trigger-actions-framework/MetadataTriggerHandler.md new file mode 100644 index 0000000..24a2b48 --- /dev/null +++ b/docs/trigger-actions-framework/MetadataTriggerHandler.md @@ -0,0 +1,381 @@ +# MetadataTriggerHandler Class + +`SUPPRESSWARNINGS` + +The `MetadataTriggerHandler` class is a trigger handler that executes Trigger +Actions defined in Custom Metadata. + +This class implements the `TriggerAction` interface for all supported Trigger Operations: + +- `BeforeInsert` +- `AfterInsert` +- `BeforeUpdate` +- `AfterUpdate` +- `BeforeDelete` +- `AfterDelete` +- `AfterUndelete` +--- +The `MetadataTriggerHandler` class reads from the `Trigger_Action__mdt` Custom Metadata type to +define Trigger Actions. + +Each Trigger Action must specify the following information: + +- `Apex_Class_Name__c` : The name of the Apex class that implements the Trigger Action. +- `Order__c` : The order in which the Trigger Action should be executed. +- `Flow_Name__c` : The name of the Flow to execute (optional). +- `Bypass_Permission__c` : The permission required to bypass the Trigger Action (optional). +- `Required_Permission__c` : The permission required to execute the Trigger Action (optional). +- `Allow_Flow_Recursion__c` : Whether or not to allow the Flow to recurse (optional). +--- + +The `MetadataTriggerHandler` class also uses the `sObject_Trigger_Setting__mdt` Custom Metadata type to define +Trigger Action settings for specific sObjects. + +Each sObject Trigger Setting must specify the following information: + +- `Bypass_Permission__c` : The permission required to bypass the Trigger Action for the specified sObject (optional). +- `Required_Permission__c` : The permission required to execute the Trigger Action for the specified sObject (optional). +--- + +To use the `MetadataTriggerHandler` class, you must create a Trigger on the desired sObject and specify the + `MetadataTriggerHandler` class as the handler. +You can then define Trigger Actions and sObject Trigger Settings in Custom Metadata to control the behavior of the Trigger. + +**Example:** + +```apex +trigger AccountTrigger on Account ( + before insert, + after insert, + before update, + after update, + before delete, + after delete, + after undelete +) { + new MetadataTriggerHandler.execute(); +} +``` + + +This example will execute all Trigger Actions defined in Custom Metadata for the `Account` sObject. + +**Group** Trigger Actions Framework + +**Inheritance** + +[TriggerBase](TriggerBase.md) + +**Implements** + +TriggerAction.BeforeInsert, +TriggerAction.AfterInsert, +TriggerAction.BeforeUpdate, +TriggerAction.AfterUpdate, +TriggerAction.BeforeDelete, +TriggerAction.AfterDelete, +TriggerAction.AfterUndelete + +## Properties +### `idToNumberOfTimesSeenBeforeUpdate` + +*Inherited* + +This method returns a map of the IDs of the records that have been seen in the `BEFORE_UPDATE` +context to the number of times they have been seen. + +#### Signature +```apex +public static idToNumberOfTimesSeenBeforeUpdate +``` + +#### Type +Map<Id,Integer> + +--- + +### `idToNumberOfTimesSeenAfterUpdate` + +*Inherited* + +This method returns a map of the IDs of the records that have been seen +in the `AFTER_UPDATE` context to the number of times they have been seen. + +#### Signature +```apex +public static idToNumberOfTimesSeenAfterUpdate +``` + +#### Type +Map<Id,Integer> + +## Methods +### `bypass(actionName)` + +Bypass the execution of a Trigger Action. + +#### Signature +```apex +public static void bypass(String actionName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| actionName | String | The name of the Trigger Action to bypass. | + +#### Return Type +**void** + +--- + +### `clearBypass(actionName)` + +Clear the bypass for a Trigger Action. + +#### Signature +```apex +public static void clearBypass(String actionName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| actionName | String | The name of the Trigger Action to clear the bypass for. | + +#### Return Type +**void** + +--- + +### `isBypassed(actionName)` + +Check if a Trigger Action is bypassed. + +#### Signature +```apex +public static Boolean isBypassed(String actionName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| actionName | String | The name of the Trigger Action to check. | + +#### Return Type +**Boolean** + +True if the Trigger Action is bypassed, false otherwise. + +--- + +### `clearAllBypasses()` + +Clear all bypasses for Trigger Actions. + +#### Signature +```apex +public static void clearAllBypasses() +``` + +#### Return Type +**void** + +--- + +### `beforeInsert(newList)` + +Execute the Before Insert Trigger Actions. + +#### Signature +```apex +public void beforeInsert(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records being inserted. | + +#### Return Type +**void** + +--- + +### `afterInsert(newList)` + +Execute the After Insert Trigger Actions. + +#### Signature +```apex +public void afterInsert(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that were inserted. | + +#### Return Type +**void** + +--- + +### `beforeUpdate(newList, oldList)` + +Execute the Before Update Trigger Actions. + +#### Signature +```apex +public void beforeUpdate(List newList, List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of updated records. | +| oldList | List<SObject> | The list of old records before the update. | + +#### Return Type +**void** + +--- + +### `afterUpdate(newList, oldList)` + +Execute the After Update Trigger Actions. + +#### Signature +```apex +public void afterUpdate(List newList, List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of updated records. | +| oldList | List<SObject> | The list of old records before the update. | + +#### Return Type +**void** + +--- + +### `beforeDelete(oldList)` + +Execute the Before Delete Trigger Actions. + +#### Signature +```apex +public void beforeDelete(List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of records being deleted. | + +#### Return Type +**void** + +--- + +### `afterDelete(oldList)` + +Execute the After Delete Trigger Actions. + +#### Signature +```apex +public void afterDelete(List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of records that were deleted. | + +#### Return Type +**void** + +--- + +### `afterUndelete(newList)` + +Execute the After Undelete Trigger Actions. + +#### Signature +```apex +public void afterUndelete(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of records that were undeleted. | + +#### Return Type +**void** + +--- + +### `offsetExistingDmlRows()` + +*Inherited* + +This method offsets the number of existing DML rows. + +#### Signature +```apex +public static void offsetExistingDmlRows() +``` + +#### Return Type +**void** + +--- + +### `waitToFinalize()` + +*Inherited* + +This method waits to finalize the DML operation. + +#### Signature +```apex +public static void waitToFinalize() +``` + +#### Return Type +**void** + +--- + +### `nowFinalize()` + +*Inherited* + +This method now finalizes the DML operation. + +#### Signature +```apex +public static void nowFinalize() +``` + +#### Return Type +**void** + +--- + +### `run()` + +*Inherited* + +This method runs the trigger handler. + +#### Signature +```apex +public void run() +``` + +#### Return Type +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerAction.md b/docs/trigger-actions-framework/TriggerAction.md new file mode 100644 index 0000000..5d5f1d6 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerAction.md @@ -0,0 +1,201 @@ +# TriggerAction Class + +`SUPPRESSWARNINGS` + +The `TriggerAction` class defines the interfaces that should be implemented by Trigger Actions. + +Trigger Actions are classes that define the logic that should be executed before or after a DML operation on a record. +The `TriggerAction` class defines the following interfaces: + +- `BeforeInsert` : This interface defines the logic that should be executed before a new record is inserted. +- `AfterInsert` : This interface defines the logic that should be executed after a new record is inserted. +- `BeforeUpdate` : This interface defines the logic that should be executed before a record is updated. +- `AfterUpdate` : This interface defines the logic that should be executed after a record is updated. +- `BeforeDelete` : This interface defines the logic that should be executed before a record is deleted. +- `AfterDelete` : This interface defines the logic that should be executed after a record is deleted. +- `AfterUndelete` : This interface defines the logic that should be executed after a record is undeleted. +- `DmlFinalizer` : This interface defines the logic that should be executed after all DML operations have completed. +--- +To implement a Trigger Action, you must create a class that implements one or more of the `TriggerAction` interfaces. + +**Group** Trigger Actions Framework + +## Interfaces +### BeforeInsert Interface + +This interface defines the logic that should be executed before +a new record is inserted. + +#### Methods +##### `beforeInsert(newList)` + +This method is called before a new record is inserted. + +###### Signature +```apex +public void beforeInsert(List newList) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that are being inserted. | + +###### Return Type +**void** + +### AfterInsert Interface + +This interface defines the logic that should be executed after a new record is inserted. + +#### Methods +##### `afterInsert(newList)` + +This method is called after a new record is inserted. + +###### Signature +```apex +public void afterInsert(List newList) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that were inserted. | + +###### Return Type +**void** + +### BeforeUpdate Interface + +This interface defines the logic that should be executed before a record is updated. + +#### Methods +##### `beforeUpdate(newList, oldList)` + +This method is called before a record is updated. + +###### Signature +```apex +public void beforeUpdate(List newList, List oldList) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that are being updated. | +| oldList | List<SObject> | The list of old records that are being updated. | + +###### Return Type +**void** + +### AfterUpdate Interface + +This interface defines the logic that should be executed after a record is updated. + +#### Methods +##### `afterUpdate(newList, oldList)` + +This method is called after a record is updated. + +###### Signature +```apex +public void afterUpdate(List newList, List oldList) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that were updated. | +| oldList | List<SObject> | The list of old records that were updated. | + +###### Return Type +**void** + +### BeforeDelete Interface + +This interface defines the logic that should be executed before a record is deleted. + +#### Methods +##### `beforeDelete(oldList)` + +This method is called before a record is deleted. + +###### Signature +```apex +public void beforeDelete(List oldList) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of old records that are being deleted. | + +###### Return Type +**void** + +### AfterDelete Interface + +This interface defines the logic that should be executed after a record is deleted. + +#### Methods +##### `afterDelete(oldList)` + +This method is called after a record is deleted. + +###### Signature +```apex +public void afterDelete(List oldList) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of old records that were deleted. | + +###### Return Type +**void** + +### AfterUndelete Interface + +This interface defines the logic that should be executed after a record is undeleted. + +#### Methods +##### `afterUndelete(newList)` + +This method is called after a record is undeleted. + +###### Signature +```apex +public void afterUndelete(List newList) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that were undeleted. | + +###### Return Type +**void** + +### DmlFinalizer Interface + +This interface defines the logic that should be executed after all DML operations have completed. + +#### Methods +##### `execute(context)` + +This method is called after all DML operations have completed. + +###### Signature +```apex +public void execute(FinalizerHandler.Context context) +``` + +###### Parameters +| Name | Type | Description | +|------|------|-------------| +| context | FinalizerHandler.Context | The context of the finalizer. | + +###### Return Type +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionConstants.md b/docs/trigger-actions-framework/TriggerActionConstants.md new file mode 100644 index 0000000..c151632 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionConstants.md @@ -0,0 +1,100 @@ +# TriggerActionConstants Class + +This class contains constants used by the TriggerAction framework. + +**Group** Trigger Actions Framework + +## Fields +### `APEX_STRING` + +#### Signature +```apex +public static final APEX_STRING +``` + +#### Type +String + +--- + +### `FLOW_STRING` + +#### Signature +```apex +public static final FLOW_STRING +``` + +#### Type +String + +--- + +### `OBJECT_STRING` + +#### Signature +```apex +public static final OBJECT_STRING +``` + +#### Type +String + +--- + +### `RECORD_PRIOR_VARIABLE` + +#### Signature +```apex +public static final RECORD_PRIOR_VARIABLE +``` + +#### Type +String + +--- + +### `RECORD_VARIABLE` + +#### Signature +```apex +public static final RECORD_VARIABLE +``` + +#### Type +String + +--- + +### `INVALID_FLOW_NAME` + +#### Signature +```apex +public static final INVALID_FLOW_NAME +``` + +#### Type +String + +--- + +### `INVALID_TYPE` + +#### Signature +```apex +public static final INVALID_TYPE +``` + +#### Type +String + +--- + +### `REQUEST_TYPES` + +#### Signature +```apex +public static final REQUEST_TYPES +``` + +#### Type +Set<String> \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlow.md b/docs/trigger-actions-framework/TriggerActionFlow.md new file mode 100644 index 0000000..df08fe4 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionFlow.md @@ -0,0 +1,271 @@ +# TriggerActionFlow Class +`virtual` + +`SUPPRESSWARNINGS` + +This class implements the TriggerAction interface and provides a framework for +executing Flows before or after the insert, update, delete, or undelete of records. + +**Group** Trigger Actions Framework + +**Implements** + +TriggerAction.BeforeInsert, +TriggerAction.AfterInsert, +TriggerAction.BeforeUpdate, +TriggerAction.AfterUpdate, +TriggerAction.BeforeDelete, +TriggerAction.AfterDelete, +TriggerAction.AfterUndelete + +## Fields +### `flowName` + +#### Signature +```apex +public flowName +``` + +#### Type +String + +--- + +### `allowRecursion` + +#### Signature +```apex +public allowRecursion +``` + +#### Type +Boolean + +## Methods +### `bypass(flowName)` + +This method bypasses the execution of the Flow for the specified list of records. + +#### Signature +```apex +public static void bypass(String flowName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| flowName | String | The API name of the Flow to bypass. | + +#### Return Type +**void** + +--- + +### `clearBypass(flowName)` + +This method clears the bypass for the specified list of records. + +#### Signature +```apex +public static void clearBypass(String flowName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| flowName | String | The API name of the Flow to clear the bypass for. | + +#### Return Type +**void** + +--- + +### `isBypassed(flowName)` + +This method checks if the Flow is bypassed for the specified list of records. + +#### Signature +```apex +public static Boolean isBypassed(String flowName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| flowName | String | The API name of the Flow to check the bypass for. | + +#### Return Type +**Boolean** + +,[object Object], if the Flow is bypassed for the specified list of records, ,[object Object], otherwise. + +--- + +### `clearAllBypasses()` + +This method clears all bypasses for all Flows. + +#### Signature +```apex +public static void clearAllBypasses() +``` + +#### Return Type +**void** + +--- + +### `validateType(bypassType)` + +This method validates the specified bypass type. + +#### Signature +```apex +public static void validateType(String bypassType) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| bypassType | String | The bypass type to validate. | + +#### Return Type +**void** + +#### Throws +IllegalArgumentException: if the bypass type is not valid. + +--- + +### `beforeInsert(newList)` + +This method executes the Flow for the specified list of records before the insert of the records. + +#### Signature +```apex +public void beforeInsert(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of records to execute the Flow for. | + +#### Return Type +**void** + +--- + +### `afterInsert(newList)` + +This method executes the Flow for the specified list of records after the insert of the records. + +#### Signature +```apex +public void afterInsert(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of records to execute the Flow for. | + +#### Return Type +**void** + +--- + +### `beforeUpdate(newList, oldList)` + +This method executes the Flow for the specified list of records before the update of the records. + +#### Signature +```apex +public void beforeUpdate(List newList, List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that are being updated. | +| oldList | List<SObject> | The list of old records that are being updated. | + +#### Return Type +**void** + +--- + +### `afterUpdate(newList, oldList)` + +This method executes the Flow for the specified list of records after the update of the records. + +#### Signature +```apex +public void afterUpdate(List newList, List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that are being updated. | +| oldList | List<SObject> | The list of old records that are being updated. | + +#### Return Type +**void** + +--- + +### `beforeDelete(oldList)` + +This method executes the Flow for the specified list of records before the delete of the records. + +#### Signature +```apex +public void beforeDelete(List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of old records that are being deleted. | + +#### Return Type +**void** + +--- + +### `afterDelete(oldList)` + +This method executes the Flow for the specified list of records after the delete of the records. + +#### Signature +```apex +public void afterDelete(List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of old records that are being deleted. | + +#### Return Type +**void** + +--- + +### `afterUndelete(newList)` + +This method executes the Flow for the specified list of records before the undelete of the records. + +#### Signature +```apex +public void afterUndelete(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of records that are being restored. | + +#### Return Type +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowAddError.md b/docs/trigger-actions-framework/TriggerActionFlowAddError.md new file mode 100644 index 0000000..21b9c43 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionFlowAddError.md @@ -0,0 +1,82 @@ +# TriggerActionFlowAddError Class + +This class provides an Invocable method that can be used to add an error to an sObject. + +The Invocable method is called `addError` and it takes a list of `Request` objects as input. +Each `Request` object contains the following properties: + +- `record` : The sObject to add the error to. +- `fieldName` : The API name of the field to add the error to. +- `errorMessage` : The error message to add. + +--- + +If the `fieldName` property is not specified, the error message will be added to the sObject without a field name. + +**Group** Trigger Actions Framework + +## Methods +### `addError(requests)` + +`INVOCABLEMETHOD` + +This Invocable method adds an error to an sObject. + +#### Signature +```apex +public static void addError(List requests) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| requests | List<Request> | A list of `Request` objects. | + +#### Return Type +**void** + +## Classes +### Request Class + +This class represents a request to add an error to an sObject. + +#### Fields +##### `record` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public record +``` + +###### Type +SObject + +--- + +##### `fieldName` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public fieldName +``` + +###### Type +String + +--- + +##### `errorMessage` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public errorMessage +``` + +###### Type +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowBypass.md b/docs/trigger-actions-framework/TriggerActionFlowBypass.md new file mode 100644 index 0000000..3529b5e --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionFlowBypass.md @@ -0,0 +1,65 @@ +# TriggerActionFlowBypass Class + +`SUPPRESSWARNINGS` + +This class provides an Invocable method that can be used to bypass a trigger action flow, Apex class, or Object trigger. + +The Invocable method is called `bypass` and it takes a list of `Request` objects as input. +Each `Request` object contains the following properties: + +- `name` : The API name of the trigger action flow, Apex class, or Object trigger to bypass. +- `bypassType` : The type of bypass to perform. Valid values are `Apex` , `Flow` , or `Object` . + +**Group** Trigger Actions Framework + +## Methods +### `bypass(requests)` + +`INVOCABLEMETHOD` + +This Invocable method bypasses a trigger action flow, Apex class, or Object trigger. + +#### Signature +```apex +public static void bypass(List requests) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| requests | List<Request> | A list of `Request` objects. | + +#### Return Type +**void** + +## Classes +### Request Class + +This class represents a request to bypass a trigger action flow, Apex class, or Object trigger. + +#### Fields +##### `name` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public name +``` + +###### Type +String + +--- + +##### `bypassType` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public bypassType +``` + +###### Type +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md b/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md new file mode 100644 index 0000000..72b4a22 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md @@ -0,0 +1,31 @@ +# TriggerActionFlowBypassProcessor Class +`abstract` + +This abstract class provides a framework for processing bypass requests for +trigger action flows, Apex classes, and Object triggers. + +To use this class, you must first create a subclass that implements the + `processApexBypasses` , `processFlowBypasses` , and `processObjectBypasses` methods. +You can then use the `execute` method to process bypass requests for the specified +type of bypass. + +**Group** Trigger Actions Framework + +## Methods +### `execute(requestType, requestName)` + +This method processes a bypass request for the specified type of bypass. + +#### Signature +```apex +public void execute(String requestType, String requestName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| requestType | String | The type of bypass to process. Valid values are `Apex` , `Flow` , or `Object` . | +| requestName | String | The name of the trigger action flow, Apex class, or Object trigger to bypass. | + +#### Return Type +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md b/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md new file mode 100644 index 0000000..948c9aa --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md @@ -0,0 +1,299 @@ +# TriggerActionFlowChangeEvent Class + +The `TriggerActionFlowChangeEvent` class is a subclass of the `TriggerActionFlow` +class that is used to handle change events. + +Change events are events that are generated when a record is created, updated, or deleted. +The `TriggerActionFlowChangeEvent` class provides the ability to access the change event header in the Flow interview. + +To use the `TriggerActionFlowChangeEvent` class, you must first create a Flow that accepts a variable of +type `FlowChangeEventHeader` . + +You can then use the `TriggerActionFlowChangeEvent` class to invoke the Flow and pass the change event header +as the input variable. + +**Group** Trigger Actions Framework + +**Inheritance** + +[TriggerActionFlow](TriggerActionFlow.md) + +## Fields +### `flowName` + +*Inherited* + +#### Signature +```apex +public flowName +``` + +#### Type +String + +--- + +### `allowRecursion` + +*Inherited* + +#### Signature +```apex +public allowRecursion +``` + +#### Type +Boolean + +## Methods +### `bypass(flowName)` + +*Inherited* + +This method bypasses the execution of the Flow for the specified list of records. + +#### Signature +```apex +public static void bypass(String flowName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| flowName | String | The API name of the Flow to bypass. | + +#### Return Type +**void** + +--- + +### `clearBypass(flowName)` + +*Inherited* + +This method clears the bypass for the specified list of records. + +#### Signature +```apex +public static void clearBypass(String flowName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| flowName | String | The API name of the Flow to clear the bypass for. | + +#### Return Type +**void** + +--- + +### `isBypassed(flowName)` + +*Inherited* + +This method checks if the Flow is bypassed for the specified list of records. + +#### Signature +```apex +public static Boolean isBypassed(String flowName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| flowName | String | The API name of the Flow to check the bypass for. | + +#### Return Type +**Boolean** + +,[object Object], if the Flow is bypassed for the specified list of records, ,[object Object], otherwise. + +--- + +### `clearAllBypasses()` + +*Inherited* + +This method clears all bypasses for all Flows. + +#### Signature +```apex +public static void clearAllBypasses() +``` + +#### Return Type +**void** + +--- + +### `validateType(bypassType)` + +*Inherited* + +This method validates the specified bypass type. + +#### Signature +```apex +public static void validateType(String bypassType) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| bypassType | String | The bypass type to validate. | + +#### Return Type +**void** + +#### Throws +IllegalArgumentException: if the bypass type is not valid. + +--- + +### `beforeInsert(newList)` + +*Inherited* + +This method executes the Flow for the specified list of records before the insert of the records. + +#### Signature +```apex +public void beforeInsert(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of records to execute the Flow for. | + +#### Return Type +**void** + +--- + +### `afterInsert(newList)` + +*Inherited* + +This method executes the Flow for the specified list of records after the insert of the records. + +#### Signature +```apex +public void afterInsert(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of records to execute the Flow for. | + +#### Return Type +**void** + +--- + +### `beforeUpdate(newList, oldList)` + +*Inherited* + +This method executes the Flow for the specified list of records before the update of the records. + +#### Signature +```apex +public void beforeUpdate(List newList, List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that are being updated. | +| oldList | List<SObject> | The list of old records that are being updated. | + +#### Return Type +**void** + +--- + +### `afterUpdate(newList, oldList)` + +*Inherited* + +This method executes the Flow for the specified list of records after the update of the records. + +#### Signature +```apex +public void afterUpdate(List newList, List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of new records that are being updated. | +| oldList | List<SObject> | The list of old records that are being updated. | + +#### Return Type +**void** + +--- + +### `beforeDelete(oldList)` + +*Inherited* + +This method executes the Flow for the specified list of records before the delete of the records. + +#### Signature +```apex +public void beforeDelete(List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of old records that are being deleted. | + +#### Return Type +**void** + +--- + +### `afterDelete(oldList)` + +*Inherited* + +This method executes the Flow for the specified list of records after the delete of the records. + +#### Signature +```apex +public void afterDelete(List oldList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| oldList | List<SObject> | The list of old records that are being deleted. | + +#### Return Type +**void** + +--- + +### `afterUndelete(newList)` + +*Inherited* + +This method executes the Flow for the specified list of records before the undelete of the records. + +#### Signature +```apex +public void afterUndelete(List newList) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| newList | List<SObject> | The list of records that are being restored. | + +#### Return Type +**void** \ No newline at end of file diff --git a/docs/Trigger-Actions-Framework/TriggerActionFlowClearAllBypasses.md b/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md similarity index 63% rename from docs/Trigger-Actions-Framework/TriggerActionFlowClearAllBypasses.md rename to docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md index 015261c..9149b69 100644 --- a/docs/Trigger-Actions-Framework/TriggerActionFlowClearAllBypasses.md +++ b/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md @@ -1,29 +1,36 @@ -# TriggerActionFlowClearAllBypasses +# TriggerActionFlowClearAllBypasses Class `SUPPRESSWARNINGS` -The `TriggerActionFlowClearAllBypasses` class is a utility class that handles the -clearing of all bypasses for objects, Apex actions, or Flow actions. -Bypasses are used to prevent the execution of specific Trigger Actions. -The `TriggerActionFlowClearAllBypasses` class provides a way to clear all bypasses for a specific object, Apex action, or Flow action. -To use the `TriggerActionFlowClearAllBypasses` class, you must first create a list of the objects, Apex actions, or Flow actions that you want to clear the bypasses for. -You can then call the `clearAllBypasses` method of the `TriggerActionFlowClearAllBypasses` class and pass the list of objects, Apex actions, or Flow actions as the input parameter. +The `TriggerActionFlowClearAllBypasses` class is a utility class that handles the +clearing of all bypasses for objects, Apex actions, or Flow actions. + +Bypasses are used to prevent the execution of specific Trigger Actions. +The `TriggerActionFlowClearAllBypasses` class provides a way to clear all bypasses for a specific object, Apex action, or Flow action. + +To use the `TriggerActionFlowClearAllBypasses` class, you must first create a list of the objects, Apex actions, or Flow actions that you want to clear the bypasses for. +You can then call the `clearAllBypasses` method of the `TriggerActionFlowClearAllBypasses` class and pass the list of objects, Apex actions, or Flow actions as the input parameter. + The `clearAllBypasses` method will clear all bypasses for the specified objects, Apex actions, or Flow actions. - **Group** Trigger Actions Framework ## Methods -### `public static void clearAllBypasses(List requests)` +### `clearAllBypasses(requests)` `INVOCABLEMETHOD` This method clears all bypasses for the specified objects, Apex actions, or Flow actions. -#### Parameters +#### Signature +```apex +public static void clearAllBypasses(List requests) +``` -|Param|Description| -|---|---| -|`requests`|A list of the objects, Apex actions, or Flow actions to clear the bypasses for.| +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| requests | List<String> | A list of the objects, Apex actions, or Flow actions to clear the bypasses for. | ---- +#### Return Type +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md b/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md new file mode 100644 index 0000000..dd8d049 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md @@ -0,0 +1,74 @@ +# TriggerActionFlowClearBypass Class + +`SUPPRESSWARNINGS` + +The `TriggerActionFlowClearBypass` class is a utility class that handles the clearing +of bypasses for objects, Apex actions, or Flow actions. + +Bypasses are used to prevent the execution of specific Trigger Actions. +The `TriggerActionFlowClearBypass` class provides a way to clear the bypass for a specific object, Apex action, or Flow action. + +To use the `TriggerActionFlowClearBypass` class, you must first create a list of the objects, Apex actions, or Flow actions that you want to clear the bypasses for. +You can then call the `clearBypass` method of the `TriggerActionFlowClearBypass` class and pass the list of objects, Apex actions, or Flow actions as the input parameter. + +The `clearBypass` method will clear the bypass for the specified objects, Apex actions, or Flow actions. + +**Group** Trigger Actions Framework + +## Methods +### `clearBypass(requests)` + +`INVOCABLEMETHOD` + +This method clears the bypass for the specified objects, Apex actions, or Flow actions. + +#### Signature +```apex +public static void clearBypass(List requests) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| requests | List<Request> | A list of the objects, Apex actions, or Flow actions to clear the bypasses for. | + +#### Return Type +**void** + +## Classes +### Request Class + +The `Request` class is a class that represents a request to clear the bypass for a +specific object, Apex action, or Flow action. + +To use the `Request` class, you must specify the following properties: + +- `name` : The API name of the object, Apex action, or Flow action to clear the bypass for. +- `bypassType` : The type of bypass to clear. Valid values are `Apex` , `Flow` , or `Object` . + +#### Fields +##### `name` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public name +``` + +###### Type +String + +--- + +##### `bypassType` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public bypassType +``` + +###### Type +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md b/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md new file mode 100644 index 0000000..8f57ff6 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md @@ -0,0 +1,80 @@ +# TriggerActionFlowIsBypassed Class + +`SUPPRESSWARNINGS` + +The `TriggerActionFlowIsBypassed` class is a utility class that handles the checking of +bypasses for objects, Apex actions, or Flow actions. + +Bypasses are used to prevent the execution of specific Trigger Actions. +The `TriggerActionFlowIsBypassed` class provides a way to check if the bypass is set +to `true` for a specific object, Apex action, or Flow action. + +To use the `TriggerActionFlowIsBypassed` class, you must first create a list of the objects, +Apex actions, or Flow actions that you want to check the bypasses for. +You can then call the `isBypassed` method of the `TriggerActionFlowIsBypassed` class and +pass the list of objects, Apex actions, or Flow actions as the input parameter. + +The `isBypassed` method will return a list of booleans indicating whether the bypass is set +to `true` for each of the specified objects, Apex actions, or Flow actions. + +**Group** Trigger Actions Framework + +## Methods +### `isBypassed(requests)` + +`INVOCABLEMETHOD` + +This method checks if the bypass is set to `true` for the specified objects, +Apex actions, or Flow actions. + +#### Signature +```apex +public static List isBypassed(List requests) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| requests | List<Request> | A list of the objects, Apex actions, or Flow actions to check the bypasses for. | + +#### Return Type +**List<Boolean>** + +A list of booleans indicating whether the bypass is set to ,[object Object], for each of the,[object Object],specified objects, Apex actions, or Flow actions. + +## Classes +### Request Class + +The `Request` class is a class that represents a request to check if the bypass is set to `true` for a specific object, Apex action, or Flow action. + +To use the `Request` class, you must specify the following properties: + +- `name` : The API name of the object, Apex action, or Flow action to check the bypass for. +- `bypassType` : The type of bypass to check. Valid values are `Apex` , `Flow` , or `Object` . + +#### Fields +##### `name` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public name +``` + +###### Type +String + +--- + +##### `bypassType` + +`INVOCABLEVARIABLE` + +###### Signature +```apex +public bypassType +``` + +###### Type +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerBase.md b/docs/trigger-actions-framework/TriggerBase.md new file mode 100644 index 0000000..77efa76 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerBase.md @@ -0,0 +1,179 @@ +# TriggerBase Class +`virtual` + +`SUPPRESSWARNINGS` + +The `TriggerBase` class is a base class for all trigger handlers. + +Trigger handlers are classes that define the logic that should be executed before or after +a DML operation on a record. +The `TriggerBase` class provides the following functionality: + +- A way to bypass the execution of specific trigger handlers. +- A way to check if a specific trigger handler is bypassed. +- A way to clear all bypasses. +- A way to offset the number of existing DML rows. +- A way to wait to finalize the DML operation. +- A way to now finalize the DML operation. +--- +To use the `TriggerBase` class, you must create a subclass that implements the `TriggerAction` interface. +The `TriggerAction` interface defines the methods that should be implemented by trigger actions. + +**Group** Trigger Actions Framework + +## Properties +### `idToNumberOfTimesSeenBeforeUpdate` + +This method returns a map of the IDs of the records that have been seen in the `BEFORE_UPDATE` +context to the number of times they have been seen. + +#### Signature +```apex +public static idToNumberOfTimesSeenBeforeUpdate +``` + +#### Type +Map<Id,Integer> + +--- + +### `idToNumberOfTimesSeenAfterUpdate` + +This method returns a map of the IDs of the records that have been seen +in the `AFTER_UPDATE` context to the number of times they have been seen. + +#### Signature +```apex +public static idToNumberOfTimesSeenAfterUpdate +``` + +#### Type +Map<Id,Integer> + +## Methods +### `bypass(sObjectName)` + +This method bypasses the execution of the specified object. + +#### Signature +```apex +public static void bypass(String sObjectName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| sObjectName | String | The API name of the object to bypass. | + +#### Return Type +**void** + +--- + +### `clearBypass(sObjectName)` + +This method clears the bypass for the specified object. + +#### Signature +```apex +public static void clearBypass(String sObjectName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| sObjectName | String | The API name of the object to clear the bypass for. | + +#### Return Type +**void** + +--- + +### `isBypassed(sObjectName)` + +This method checks if the specified object is bypassed. + +#### Signature +```apex +public static Boolean isBypassed(String sObjectName) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| sObjectName | String | The API name of the object to check the bypass for. | + +#### Return Type +**Boolean** + +True if the object is bypassed, false otherwise. + +--- + +### `clearAllBypasses()` + +This method clears all bypasses. + +#### Signature +```apex +public static void clearAllBypasses() +``` + +#### Return Type +**void** + +--- + +### `offsetExistingDmlRows()` + +This method offsets the number of existing DML rows. + +#### Signature +```apex +public static void offsetExistingDmlRows() +``` + +#### Return Type +**void** + +--- + +### `waitToFinalize()` + +This method waits to finalize the DML operation. + +#### Signature +```apex +public static void waitToFinalize() +``` + +#### Return Type +**void** + +--- + +### `nowFinalize()` + +This method now finalizes the DML operation. + +#### Signature +```apex +public static void nowFinalize() +``` + +#### Return Type +**void** + +--- + +### `run()` + +This method runs the trigger handler. + +#### Signature +```apex +public void run() +``` + +#### Return Type +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerTestUtility.md b/docs/trigger-actions-framework/TriggerTestUtility.md new file mode 100644 index 0000000..5783ba3 --- /dev/null +++ b/docs/trigger-actions-framework/TriggerTestUtility.md @@ -0,0 +1,32 @@ +# TriggerTestUtility Class + +`ISTEST` + +The `TriggerTestUtility` class is a utility class that provides helper methods for writing +Apex test classes for trigger handlers. + +The `TriggerTestUtility` class provides the following helper methods: + +- `getFakeId` : This method generates a fake ID for the specified sObject type. + +**Group** Trigger Actions Framework + +## Methods +### `getFakeId(sObjectType)` + +This method generates a fake ID for the specified sObject type. + +#### Signature +```apex +public static Id getFakeId(Schema.SObjectType sObjectType) +``` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| sObjectType | Schema.SObjectType | The sObject type to generate a fake ID for. | + +#### Return Type +**Id** + +A fake ID for the specified sObject type. \ No newline at end of file