From 884a527c3612ace5b448747f971abc40bf08bc1a Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Wed, 19 Mar 2025 15:58:41 -0700 Subject: [PATCH 01/16] project files --- .github/workflows/CI.yml | 11 +++++++---- package.json | 30 +++++++++--------------------- sfdx-project.json | 2 +- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 66b92a7..4758921 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,15 +11,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.ref }} fetch-depth: 0 - - uses: actions/setup-node@v1 + - name: "Setup node" + uses: actions/setup-node@v4 with: - node-version: ">=14" - check-latest: true + node-version: "lts/*" + #cache: "npm" - name: Install Salesforce CLI + Scanner run: | @@ -29,6 +30,7 @@ jobs: sf plugins install @salesforce/sfdx-scanner - name: Run SFDX Scanner - Report findings as comments + if: github.event_name == 'pull_request' uses: mitchspano/sfdx-scan-pull-request@v0.1.16 with: severity-threshold: 4 @@ -37,6 +39,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Authenticate into DevHub + id: authenticate run: | echo "${SALESFORCE_JWT_SECRET_KEY}" > server.key sf org login jwt --client-id ${{ secrets.SALESFORCE_CONSUMER_KEY }} --jwt-key-file server.key --username ${{ secrets.SALESFORCE_DEVHUB_USERNAME}} --set-default-dev-hub --alias devhub diff --git a/package.json b/package.json index 6664238..4bc23b9 100644 --- a/package.json +++ b/package.json @@ -4,28 +4,18 @@ "version": "1.0.0", "description": "Apex Trigger Actions Framework", "scripts": { - "lint": "npm run lint:lwc && npm run lint:aura", - "lint:aura": "eslint **/aura/**", - "lint:lwc": "eslint **/lwc/**", - "test": "npm run test:unit", - "test:unit": "sfdx-lwc-jest", - "test:unit:watch": "sfdx-lwc-jest --watch", - "test:unit:debug": "sfdx-lwc-jest --debug", - "test:unit:coverage": "sfdx-lwc-jest --coverage", + "prepare": "husky", "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,yaml,yml}\"", "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,yaml,yml}\"" }, "devDependencies": { - "@prettier/plugin-xml": "^0.13.1", - "@salesforce/eslint-config-lwc": "^0.11.1", - "@salesforce/eslint-plugin-aura": "^2.0.0", - "@salesforce/sfdx-lwc-jest": "^0.10.4", - "eslint": "^7.24.0", - "eslint-config-prettier": "^8.1.0", - "husky": "^6.0.0", - "lint-staged": "^10.5.4", - "prettier": "3.0.2", - "prettier-plugin-apex": "2.0.1" + "@prettier/plugin-xml": "^3.4.1", + "eslint": "^9.22.0", + "eslint-config-prettier": "^10.1.1", + "husky": "^9.1.7", + "lint-staged": "^15.5.0", + "prettier": "3.5.3", + "prettier-plugin-apex": "2.2.5" }, "husky": { "hooks": { @@ -36,8 +26,6 @@ "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ "prettier --write" ], - "**/{aura|lwc}/**": [ - "eslint" - ] + "**/{aura|lwc}/**": ["eslint"] } } diff --git a/sfdx-project.json b/sfdx-project.json index 434d9e2..1422e07 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -45,4 +45,4 @@ "Trigger Actions Framework@0.3.1-7": "04tKY000000PdZJYA0", "Trigger Actions Framework@0.3.2": "04tKY000000PdZOYA0" } -} +} \ No newline at end of file From c1d8970e8d88bb38207d7e340798fc3c5366ad22 Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Wed, 19 Mar 2025 16:02:45 -0700 Subject: [PATCH 02/16] run prettier --- .github/workflows/CI.yml | 4 +- .github/workflows/Package.yml | 2 +- .prettierrc | 72 +++- config/project-scratch-def.json | 6 +- docs/custom-objects/DML_Finalizer__mdt.md | 20 +- docs/custom-objects/Trigger_Action__mdt.md | 53 ++- .../sObject_Trigger_Setting__mdt.md | 24 +- docs/index.md | 377 +++++++++--------- .../FinalizerHandler.md | 94 +++-- .../FlowChangeEventHeader.md | 50 ++- .../MetadataTriggerHandler.md | 225 +++++++---- .../TriggerAction.md | 99 +++-- .../TriggerActionConstants.md | 19 +- .../TriggerActionFlow.md | 103 +++-- .../TriggerActionFlowAddError.md | 40 +- .../TriggerActionFlowBypass.md | 28 +- .../TriggerActionFlowBypassProcessor.md | 25 +- .../TriggerActionFlowChangeEvent.md | 136 ++++--- .../TriggerActionFlowClearAllBypasses.md | 28 +- .../TriggerActionFlowClearBypass.md | 46 ++- .../TriggerActionFlowIsBypassed.md | 54 ++- docs/trigger-actions-framework/TriggerBase.md | 74 ++-- .../TriggerTestUtility.md | 20 +- package.json | 60 +-- sfdx-project.json | 94 ++--- .../main/default/classes/FinalizerHandler.cls | 24 +- .../classes/FinalizerHandler.cls-meta.xml | 2 +- .../default/classes/FinalizerHandlerTest.cls | 22 +- .../classes/FinalizerHandlerTest.cls-meta.xml | 2 +- .../default/classes/FlowChangeEventHeader.cls | 2 +- .../FlowChangeEventHeader.cls-meta.xml | 2 +- .../classes/FlowChangeEventHeaderTest.cls | 11 +- .../FlowChangeEventHeaderTest.cls-meta.xml | 2 +- .../main/default/classes/FormulaFilter.cls | 33 +- .../classes/FormulaFilter.cls-meta.xml | 2 +- .../default/classes/FormulaFilterTest.cls | 92 +---- .../classes/FormulaFilterTest.cls-meta.xml | 2 +- .../classes/MetadataTriggerHandler.cls | 131 ++---- .../MetadataTriggerHandler.cls-meta.xml | 2 +- .../classes/MetadataTriggerHandlerTest.cls | 116 ++---- .../MetadataTriggerHandlerTest.cls-meta.xml | 2 +- .../main/default/classes/TriggerAction.cls | 2 +- .../classes/TriggerAction.cls-meta.xml | 2 +- .../classes/TriggerActionConstants.cls | 2 +- .../TriggerActionConstants.cls-meta.xml | 2 +- .../default/classes/TriggerActionFlow.cls | 52 +-- .../classes/TriggerActionFlow.cls-meta.xml | 2 +- .../classes/TriggerActionFlowAddError.cls | 19 +- .../TriggerActionFlowAddError.cls-meta.xml | 2 +- .../classes/TriggerActionFlowAddErrorTest.cls | 24 +- ...TriggerActionFlowAddErrorTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowBypass.cls | 8 +- .../TriggerActionFlowBypass.cls-meta.xml | 2 +- .../TriggerActionFlowBypassProcessor.cls | 2 +- ...ggerActionFlowBypassProcessor.cls-meta.xml | 2 +- .../classes/TriggerActionFlowBypassTest.cls | 12 +- .../TriggerActionFlowBypassTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowChangeEvent.cls | 2 +- .../TriggerActionFlowChangeEvent.cls-meta.xml | 2 +- .../TriggerActionFlowChangeEventTest.cls | 2 +- ...ggerActionFlowChangeEventTest.cls-meta.xml | 2 +- .../TriggerActionFlowClearAllBypasses.cls | 2 +- ...gerActionFlowClearAllBypasses.cls-meta.xml | 2 +- .../TriggerActionFlowClearAllBypassesTest.cls | 11 +- ...ctionFlowClearAllBypassesTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowClearBypass.cls | 10 +- .../TriggerActionFlowClearBypass.cls-meta.xml | 2 +- .../TriggerActionFlowClearBypassTest.cls | 7 +- ...ggerActionFlowClearBypassTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowIsBypassed.cls | 2 +- .../TriggerActionFlowIsBypassed.cls-meta.xml | 2 +- .../TriggerActionFlowIsBypassedTest.cls | 20 +- ...iggerActionFlowIsBypassedTest.cls-meta.xml | 2 +- .../default/classes/TriggerActionFlowTest.cls | 103 +---- .../TriggerActionFlowTest.cls-meta.xml | 2 +- .../main/default/classes/TriggerBase.cls | 21 +- .../default/classes/TriggerBase.cls-meta.xml | 2 +- .../main/default/classes/TriggerBaseTest.cls | 58 +-- .../classes/TriggerBaseTest.cls-meta.xml | 2 +- .../main/default/classes/TriggerRecord.cls | 2 +- .../classes/TriggerRecord.cls-meta.xml | 2 +- .../default/classes/TriggerRecordTest.cls | 2 +- .../classes/TriggerRecordTest.cls-meta.xml | 2 +- .../default/classes/TriggerTestUtility.cls | 5 +- .../classes/TriggerTestUtility.cls-meta.xml | 2 +- ...__mdt-DML Finalizer Layout.layout-meta.xml | 8 +- .../fields/Apex_Class_Name__c.field-meta.xml | 2 +- .../Trigger_Action__mdt.object-meta.xml | 2 +- .../fields/After_Delete__c.field-meta.xml | 8 +- .../fields/After_Insert__c.field-meta.xml | 8 +- .../fields/After_Undelete__c.field-meta.xml | 8 +- .../fields/After_Update__c.field-meta.xml | 8 +- .../Allow_Flow_Recursion__c.field-meta.xml | 8 +- .../fields/Apex_Class_Name__c.field-meta.xml | 8 +- .../fields/Before_Delete__c.field-meta.xml | 8 +- .../fields/Before_Insert__c.field-meta.xml | 8 +- .../fields/Before_Update__c.field-meta.xml | 8 +- .../fields/Bypass_Execution__c.field-meta.xml | 8 +- .../Bypass_Permission__c.field-meta.xml | 8 +- .../fields/Description__c.field-meta.xml | 2 +- .../fields/Flow_Name__c.field-meta.xml | 8 +- .../fields/Order__c.field-meta.xml | 2 +- .../Required_Permission__c.field-meta.xml | 8 +- ...iption_is_Required.validationRule-meta.xml | 8 +- ...t_Choose_A_Context.validationRule-meta.xml | 5 +- .../Only_One_Context.validationRule-meta.xml | 5 +- ...ion_Only_For_Flows.validationRule-meta.xml | 11 +- .../fields/Bypass_Execution__c.field-meta.xml | 8 +- .../Bypass_Permission__c.field-meta.xml | 8 +- .../fields/Object_API_Name__c.field-meta.xml | 8 +- .../fields/Object_Namespace__c.field-meta.xml | 5 +- .../Required_Permission__c.field-meta.xml | 8 +- ...bject_Trigger_Setting__mdt.object-meta.xml | 2 +- 113 files changed, 1387 insertions(+), 1413 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4758921..8444770 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,10 +16,10 @@ jobs: ref: ${{ github.ref }} fetch-depth: 0 - - name: "Setup node" + - name: 'Setup node' uses: actions/setup-node@v4 with: - node-version: "lts/*" + node-version: 'lts/*' #cache: "npm" - name: Install Salesforce CLI + Scanner diff --git a/.github/workflows/Package.yml b/.github/workflows/Package.yml index 98da286..b1a612e 100644 --- a/.github/workflows/Package.yml +++ b/.github/workflows/Package.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: ">=20" + node-version: 'lts/*' - name: Install sf cli run: | diff --git a/.prettierrc b/.prettierrc index 50f14e3..08737ee 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,15 +1,81 @@ { - "plugins": ["prettier-plugin-apex"], + "arrowParens": "avoid", + "bracketSpacing": true, + "bracketSameLine": true, + "printWidth": 100, + "semi": true, + "singleQuote": true, "trailingComma": "none", + "endOfLine": "lf", + "apexInsertFinalNewline": false, "useTabs": true, "overrides": [ { "files": "**/lwc/**/*.html", "options": { "parser": "lwc" } }, + { + "files": "*.{cls,trigger}", + "options": { "parser": "apex", "tabWidth": 2, "useTabs": true } + }, + { + "files": "*.trigger", + "options": { "printWidth": 200 } + }, { "files": "*.{cmp,page,component}", - "options": { "parser": "html" } + "options": { + "parser": "html", + "useTabs": true, + "htmlWhitespaceSensitivity": "css" + } + }, + { + "files": "*.{apex,soql}", + "options": { "parser": "apex-anonymous" } + }, + { + "files": "*.{yml,yaml}", + "options": { "parser": "yaml", "tabWidth": 2, "useTabs": false } + }, + { + "files": ".prettier*", + "options": { "parser": "json", "printWidth": 80, "useTabs": true } + }, + { + "files": "*.xml", + "options": { + "parser": "xml", + "useTabs": true, + "singleQuote": false, + "xmlSelfClosingSpace": true + } + }, + { + "files": ["**/pmd/*.xml", "*ruleset*.xml", "config/**/*.xml"], + "options": { + "parser": "xml", + "xmlSelfClosingSpace": true, + "xmlWhitespaceSensitivity": "ignore" + } + }, + { + "files": "*meta.xml", + "options": { + "parser": "xml", + "useTabs": false, + "xmlSelfClosingSpace": false + } + }, + { + "files": "*.json", + "options": { + "parser": "json-stringify", + "useTabs": false, + "tabWidth": 2 + } } - ] + ], + "plugins": ["prettier-plugin-apex", "@prettier/plugin-xml"], + "$schema": "https://json.schemastore.org/prettierrc" } diff --git a/config/project-scratch-def.json b/config/project-scratch-def.json index 796801d..8645f62 100644 --- a/config/project-scratch-def.json +++ b/config/project-scratch-def.json @@ -1,5 +1,5 @@ { - "orgName": "Demo company", - "edition": "Developer", - "features": [] + "orgName": "Demo company", + "edition": "Developer", + "features": [] } diff --git a/docs/custom-objects/DML_Finalizer__mdt.md b/docs/custom-objects/DML_Finalizer__mdt.md index 0643cca..6bd61fe 100644 --- a/docs/custom-objects/DML_Finalizer__mdt.md +++ b/docs/custom-objects/DML_Finalizer__mdt.md @@ -1,10 +1,13 @@ # 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 @@ -15,9 +18,10 @@ Enter the name of the Apex Class which defines the action to be taken **Type** -*Text* +_Text_ --- + ### Bypass Execution Set this to true to bypass this Trigger Action from being called @@ -28,9 +32,10 @@ Set this to true to bypass this Trigger Action from being called **Type** -*Checkbox* +_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. @@ -41,10 +46,12 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*Text* +_Text_ --- + ### Order + **Required** **API Name** @@ -53,12 +60,13 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*Number* +_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. +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** @@ -66,4 +74,4 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*Text* \ No newline at end of file +_Text_ diff --git a/docs/custom-objects/Trigger_Action__mdt.md b/docs/custom-objects/Trigger_Action__mdt.md index b57bca8..e527f90 100644 --- a/docs/custom-objects/Trigger_Action__mdt.md +++ b/docs/custom-objects/Trigger_Action__mdt.md @@ -1,9 +1,11 @@ # 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 @@ -14,9 +16,10 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -*MetadataRelationship* +_MetadataRelationship_ --- + ### After Insert Enter the name of the sObject you want to have this action execute on during the after insert context @@ -27,9 +30,10 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -*MetadataRelationship* +_MetadataRelationship_ --- + ### After Undelete Enter the name of the sObject you want to have this action execute on during the after undelete context @@ -40,9 +44,10 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -*MetadataRelationship* +_MetadataRelationship_ --- + ### After Update Enter the name of the sObject you want to have this action execute on during the after update context @@ -53,9 +58,10 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -*MetadataRelationship* +_MetadataRelationship_ --- + ### Allow Flow Recursion? Check this box to allow the flow to execute recursively @@ -66,10 +72,12 @@ Check this box to allow the flow to execute recursively **Type** -*Checkbox* +_Checkbox_ --- + ### Apex Class Name + **Required** Enter the name of the Apex Class which defines the action to be taken @@ -80,9 +88,10 @@ Enter the name of the Apex Class which defines the action to be taken **Type** -*Text* +_Text_ --- + ### Before Delete Enter the name of the sObject you want to have this action execute on during the before delete context @@ -93,9 +102,10 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -*MetadataRelationship* +_MetadataRelationship_ --- + ### Before Insert Enter the name of the sObject you want to have this action execute on during the before insert context @@ -106,9 +116,10 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -*MetadataRelationship* +_MetadataRelationship_ --- + ### Before Update Enter the name of the sObject you want to have this action execute on during the before update context @@ -119,9 +130,10 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -*MetadataRelationship* +_MetadataRelationship_ --- + ### Bypass Execution Set this to true to bypass this Trigger Action from being called @@ -132,9 +144,10 @@ Set this to true to bypass this Trigger Action from being called **Type** -*Checkbox* +_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. @@ -145,9 +158,10 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*Text* +_Text_ --- + ### Description **API Name** @@ -156,9 +170,10 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*LongTextArea* +_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. @@ -169,9 +184,10 @@ Formula which if evaluated to true for a given record during trigger processing, **Type** -*LongTextArea* +_LongTextArea_ --- + ### Flow Name Enter the API name of the flow you would like to execute. @@ -182,10 +198,12 @@ Enter the API name of the flow you would like to execute. **Type** -*Text* +_Text_ --- + ### Order + **Required** **API Name** @@ -194,12 +212,13 @@ Enter the API name of the flow you would like to execute. **Type** -*Number* +_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. +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** @@ -207,4 +226,4 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*Text* \ No newline at end of file +_Text_ diff --git a/docs/custom-objects/sObject_Trigger_Setting__mdt.md b/docs/custom-objects/sObject_Trigger_Setting__mdt.md index 5e8d402..193d55a 100644 --- a/docs/custom-objects/sObject_Trigger_Setting__mdt.md +++ b/docs/custom-objects/sObject_Trigger_Setting__mdt.md @@ -1,9 +1,11 @@ # 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 @@ -14,9 +16,10 @@ Set this to true to bypass all Trigger Actions from being called on this sObject **Type** -*Checkbox* +_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. @@ -27,10 +30,12 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*Text* +_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. @@ -41,9 +46,10 @@ Enter the API Name of the object for this trigger. If this object is part of a m **Type** -*Text* +_Text_ --- + ### Object Namespace Enter the namespace object for this trigger. @@ -54,9 +60,10 @@ Enter the namespace object for this trigger. **Type** -*Text* +_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. @@ -67,14 +74,15 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -*Text* +_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. +and `recordPrior`. Both of these variables need to match the SObject type for this SObject +Trigger Setting record. **API Name** @@ -82,4 +90,4 @@ Enter the API name of a global class which extends `TriggerRecord` and **Type** -*Text* \ No newline at end of file +_Text_ diff --git a/docs/index.md b/docs/index.md index 7e0dc28..7469a9d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,128 +2,137 @@ ## Custom Objects -### [DML_Finalizer__mdt](custom-objects/DML_Finalizer__mdt.md) +### [DML_Finalizer\_\_mdt](custom-objects/DML_Finalizer__mdt.md) -### [Trigger_Action__mdt](custom-objects/Trigger_Action__mdt.md) +### [Trigger_Action\_\_mdt](custom-objects/Trigger_Action__mdt.md) -### [sObject_Trigger_Setting__mdt](custom-objects/sObject_Trigger_Setting__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 `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-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:** - +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 +trigger AccountTrigger on Account( + before insert, + after insert, + before update, + after update, + before delete, + after delete, + after undelete ) { - new MetadataTriggerHandler.run(); + new MetadataTriggerHandler.run(); } ``` - 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. ---- +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) @@ -132,124 +141,126 @@ 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 +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. - ---- - +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. +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 +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 +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 `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 `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 +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 `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 +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. diff --git a/docs/trigger-actions-framework/FinalizerHandler.md b/docs/trigger-actions-framework/FinalizerHandler.md index e3d5fb7..0b6a23a 100644 --- a/docs/trigger-actions-framework/FinalizerHandler.md +++ b/docs/trigger-actions-framework/FinalizerHandler.md @@ -1,55 +1,64 @@ # 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 `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 | -|------|------|-------------| + +| Name | Type | Description | +| --------- | ------ | ------------------------------------ | | finalizer | String | The name of the finalizer to bypass. | #### Return Type + **void** --- @@ -59,16 +68,19 @@ public static void bypass(String finalizer) Clear the bypass for a specific finalizer. #### Signature + ```apex public static void clearBypass(String finalizer) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| --------- | ------ | -------------------------------------------------- | | finalizer | String | The name of the finalizer to clear the bypass for. | #### Return Type + **void** --- @@ -78,16 +90,19 @@ public static void clearBypass(String finalizer) Check if a specific finalizer is bypassed. #### Signature + ```apex public static Boolean isBypassed(String finalizer) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| --------- | ------ | ----------------------------------- | | finalizer | String | The name of the finalizer to check. | #### Return Type + **Boolean** True if the finalizer is bypassed, false otherwise. @@ -99,11 +114,13 @@ True if the finalizer is bypassed, false otherwise. Clear all bypasses. #### Signature + ```apex public static void clearAllBypasses() ``` #### Return Type + **void** --- @@ -113,15 +130,18 @@ public static void clearAllBypasses() Handle dynamic finalizers. Instantiates 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 +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 index 0529726..8b4a319 100644 --- a/docs/trigger-actions-framework/FlowChangeEventHeader.md +++ b/docs/trigger-actions-framework/FlowChangeEventHeader.md @@ -1,6 +1,6 @@ # FlowChangeEventHeader Class -A flow-accessible version of the ChangeEventHeader class for use in +A flow-accessible version of the ChangeEventHeader class for use in a flow handler of a change data capture event. **Group** Trigger Actions Framework @@ -8,17 +8,20 @@ a flow handler of a change data capture event. **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 --- @@ -29,11 +32,13 @@ String `AURAENABLED` #### Signature + ```apex public recordIds ``` #### Type + List<String> --- @@ -44,11 +49,13 @@ List<String> `AURAENABLED` #### Signature + ```apex public changeType ``` #### Type + String --- @@ -59,11 +66,13 @@ String `AURAENABLED` #### Signature + ```apex public changeOrigin ``` #### Type + String --- @@ -74,11 +83,13 @@ String `AURAENABLED` #### Signature + ```apex public transactionKey ``` #### Type + String --- @@ -89,11 +100,13 @@ String `AURAENABLED` #### Signature + ```apex public sequenceNumber ``` #### Type + Integer --- @@ -104,11 +117,13 @@ Integer `AURAENABLED` #### Signature + ```apex public commitTimestamp ``` #### Type + Long --- @@ -119,11 +134,13 @@ Long `AURAENABLED` #### Signature + ```apex public commitUser ``` #### Type + String --- @@ -134,11 +151,13 @@ String `AURAENABLED` #### Signature + ```apex public commitNumber ``` #### Type + Long --- @@ -149,11 +168,13 @@ Long `AURAENABLED` #### Signature + ```apex public nulledFields ``` #### Type + List<String> --- @@ -164,11 +185,13 @@ List<String> `AURAENABLED` #### Signature + ```apex public diffFields ``` #### Type + List<String> --- @@ -179,45 +202,54 @@ List<String> `AURAENABLED` #### Signature + ```apex public changedFields ``` #### Type + List<String> ## Constructors + ### `FlowChangeEventHeader(header)` -Constructor that takes an `EventBus.ChangeEventHeader` object and populates +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 | -|------|------|-------------| + +| 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. | + +| 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. @@ -229,11 +261,13 @@ public Boolean equals(Object obj) 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 +A hash code value for this ,[object Object], object. diff --git a/docs/trigger-actions-framework/MetadataTriggerHandler.md b/docs/trigger-actions-framework/MetadataTriggerHandler.md index 64b5bb3..175017b 100644 --- a/docs/trigger-actions-framework/MetadataTriggerHandler.md +++ b/docs/trigger-actions-framework/MetadataTriggerHandler.md @@ -2,62 +2,65 @@ `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:** - +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 +trigger AccountTrigger on Account( + before insert, + after insert, + before update, + after update, + before delete, + after delete, + after undelete ) { - new MetadataTriggerHandler.run(); + new MetadataTriggerHandler.run(); } ``` - This example will execute all Trigger Actions defined in Custom Metadata for the `Account` sObject. **Group** Trigger Actions Framework @@ -68,63 +71,72 @@ This example will execute all Trigger Actions defined in Custom Metadata for the **Implements** -TriggerAction.BeforeInsert, -TriggerAction.AfterInsert, -TriggerAction.BeforeUpdate, -TriggerAction.AfterUpdate, -TriggerAction.BeforeDelete, -TriggerAction.AfterDelete, +TriggerAction.BeforeInsert, +TriggerAction.AfterInsert, +TriggerAction.BeforeUpdate, +TriggerAction.AfterUpdate, +TriggerAction.BeforeDelete, +TriggerAction.AfterDelete, TriggerAction.AfterUndelete ## Properties + ### `idToNumberOfTimesSeenBeforeUpdate` -*Inherited* +_Inherited_ -This method returns a map of the IDs of the records that have been seen in the `BEFORE_UPDATE` +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* +_Inherited_ -This method returns a map of the IDs of the records that have been seen +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 | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------ | ----------------------------------------- | | actionName | String | The name of the Trigger Action to bypass. | #### Return Type + **void** --- @@ -134,16 +146,19 @@ public static void bypass(String actionName) Clear the bypass for a Trigger Action. #### Signature + ```apex public static void clearBypass(String actionName) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------ | ------------------------------------------------------- | | actionName | String | The name of the Trigger Action to clear the bypass for. | #### Return Type + **void** --- @@ -153,16 +168,19 @@ public static void clearBypass(String actionName) Check if a Trigger Action is bypassed. #### Signature + ```apex public static Boolean isBypassed(String actionName) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| 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. @@ -174,11 +192,13 @@ True if the Trigger Action is bypassed, false otherwise. Clear all bypasses for Trigger Actions. #### Signature + ```apex public static void clearAllBypasses() ``` #### Return Type + **void** --- @@ -188,16 +208,19 @@ public static void clearAllBypasses() Execute the Before Insert Trigger Actions. #### Signature + ```apex public void beforeInsert(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | --------------------------------------- | | triggerNew | List<SObject> | The list of new records being inserted. | #### Return Type + **void** --- @@ -207,16 +230,19 @@ public void beforeInsert(List triggerNew) Execute the After Insert Trigger Actions. #### Signature + ```apex public void afterInsert(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ------------------------------------------- | | triggerNew | List<SObject> | The list of new records that were inserted. | #### Return Type + **void** --- @@ -226,17 +252,20 @@ public void afterInsert(List triggerNew) Execute the Before Update Trigger Actions. #### Signature + ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| -| triggerNew | List<SObject> | The list of updated records. | + +| Name | Type | Description | +| ---------- | ------------------- | ------------------------------------------ | +| triggerNew | List<SObject> | The list of updated records. | | triggerOld | List<SObject> | The list of old records before the update. | #### Return Type + **void** --- @@ -246,17 +275,20 @@ public void beforeUpdate(List triggerNew, List triggerOld) Execute the After Update Trigger Actions. #### Signature + ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| -| triggerNew | List<SObject> | The list of updated records. | + +| Name | Type | Description | +| ---------- | ------------------- | ------------------------------------------ | +| triggerNew | List<SObject> | The list of updated records. | | triggerOld | List<SObject> | The list of old records before the update. | #### Return Type + **void** --- @@ -266,16 +298,19 @@ public void afterUpdate(List triggerNew, List triggerOld) Execute the Before Delete Trigger Actions. #### Signature + ```apex public void beforeDelete(List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ---------------------------------- | | triggerOld | List<SObject> | The list of records being deleted. | #### Return Type + **void** --- @@ -285,16 +320,19 @@ public void beforeDelete(List triggerOld) Execute the After Delete Trigger Actions. #### Signature + ```apex public void afterDelete(List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------- | | triggerOld | List<SObject> | The list of records that were deleted. | #### Return Type + **void** --- @@ -304,78 +342,89 @@ public void afterDelete(List triggerOld) Execute the After Undelete Trigger Actions. #### Signature + ```apex public void afterUndelete(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ---------------------------------------- | | triggerNew | List<SObject> | The list of records that were undeleted. | #### Return Type + **void** --- ### `offsetExistingDmlRows()` -*Inherited* +_Inherited_ This method offsets the number of existing DML rows. #### Signature + ```apex public static void offsetExistingDmlRows() ``` #### Return Type + **void** --- ### `waitToFinalize()` -*Inherited* +_Inherited_ This method waits to finalize the DML operation. #### Signature + ```apex public static void waitToFinalize() ``` #### Return Type + **void** --- ### `nowFinalize()` -*Inherited* +_Inherited_ This method now finalizes the DML operation. #### Signature + ```apex public static void nowFinalize() ``` #### Return Type + **void** --- ### `run()` -*Inherited* +_Inherited_ This method runs the trigger handler. #### Signature + ```apex public void run() ``` #### Return Type -**void** \ No newline at end of file + +**void** diff --git a/docs/trigger-actions-framework/TriggerAction.md b/docs/trigger-actions-framework/TriggerAction.md index 412730a..7abee67 100644 --- a/docs/trigger-actions-framework/TriggerAction.md +++ b/docs/trigger-actions-framework/TriggerAction.md @@ -2,46 +2,53 @@ `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. ---- +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 +This interface defines the logic that should be executed before a new record is inserted. #### Methods + ##### `beforeInsert(triggerNew)` This method is called before a new record is inserted. ###### Signature + ```apex public void beforeInsert(List triggerNew) ``` ###### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ------------------------------------------------ | | triggerNew | List<SObject> | The list of new records that are being inserted. | ###### Return Type + **void** ### AfterInsert Interface @@ -49,21 +56,25 @@ public void beforeInsert(List triggerNew) This interface defines the logic that should be executed after a new record is inserted. #### Methods + ##### `afterInsert(triggerNew)` This method is called after a new record is inserted. ###### Signature + ```apex public void afterInsert(List triggerNew) ``` ###### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ------------------------------------------- | | triggerNew | List<SObject> | The list of new records that were inserted. | ###### Return Type + **void** ### BeforeUpdate Interface @@ -71,22 +82,26 @@ public void afterInsert(List triggerNew) This interface defines the logic that should be executed before a record is updated. #### Methods + ##### `beforeUpdate(triggerNew, triggerOld)` This method is called before a record is updated. ###### Signature + ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` ###### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | ###### Return Type + **void** ### AfterUpdate Interface @@ -94,22 +109,26 @@ public void beforeUpdate(List triggerNew, List triggerOld) This interface defines the logic that should be executed after a record is updated. #### Methods + ##### `afterUpdate(triggerNew, triggerOld)` This method is called after a record is updated. ###### Signature + ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` ###### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ------------------------------------------ | | triggerNew | List<SObject> | The list of new records that were updated. | | triggerOld | List<SObject> | The list of old records that were updated. | ###### Return Type + **void** ### BeforeDelete Interface @@ -117,21 +136,25 @@ public void afterUpdate(List triggerNew, List triggerOld) This interface defines the logic that should be executed before a record is deleted. #### Methods + ##### `beforeDelete(triggerOld)` This method is called before a record is deleted. ###### Signature + ```apex public void beforeDelete(List triggerOld) ``` ###### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerOld | List<SObject> | The list of old records that are being deleted. | ###### Return Type + **void** ### AfterDelete Interface @@ -139,21 +162,25 @@ public void beforeDelete(List triggerOld) This interface defines the logic that should be executed after a record is deleted. #### Methods + ##### `afterDelete(triggerOld)` This method is called after a record is deleted. ###### Signature + ```apex public void afterDelete(List triggerOld) ``` ###### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ------------------------------------------ | | triggerOld | List<SObject> | The list of old records that were deleted. | ###### Return Type + **void** ### AfterUndelete Interface @@ -161,21 +188,25 @@ public void afterDelete(List triggerOld) This interface defines the logic that should be executed after a record is undeleted. #### Methods + ##### `afterUndelete(triggerNew)` This method is called after a record is undeleted. ###### Signature + ```apex public void afterUndelete(List triggerNew) ``` ###### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------------- | | triggerNew | List<SObject> | The list of new records that were undeleted. | ###### Return Type + **void** ### DmlFinalizer Interface @@ -183,19 +214,23 @@ public void afterUndelete(List triggerNew) 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 | -|------|------|-------------| + +| Name | Type | Description | +| ------- | ------------------------ | ----------------------------- | | context | FinalizerHandler.Context | The context of the finalizer. | ###### Return Type -**void** \ No newline at end of file + +**void** diff --git a/docs/trigger-actions-framework/TriggerActionConstants.md b/docs/trigger-actions-framework/TriggerActionConstants.md index c151632..180608c 100644 --- a/docs/trigger-actions-framework/TriggerActionConstants.md +++ b/docs/trigger-actions-framework/TriggerActionConstants.md @@ -5,14 +5,17 @@ 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 --- @@ -20,11 +23,13 @@ String ### `FLOW_STRING` #### Signature + ```apex public static final FLOW_STRING ``` #### Type + String --- @@ -32,11 +37,13 @@ String ### `OBJECT_STRING` #### Signature + ```apex public static final OBJECT_STRING ``` #### Type + String --- @@ -44,11 +51,13 @@ String ### `RECORD_PRIOR_VARIABLE` #### Signature + ```apex public static final RECORD_PRIOR_VARIABLE ``` #### Type + String --- @@ -56,11 +65,13 @@ String ### `RECORD_VARIABLE` #### Signature + ```apex public static final RECORD_VARIABLE ``` #### Type + String --- @@ -68,11 +79,13 @@ String ### `INVALID_FLOW_NAME` #### Signature + ```apex public static final INVALID_FLOW_NAME ``` #### Type + String --- @@ -80,11 +93,13 @@ String ### `INVALID_TYPE` #### Signature + ```apex public static final INVALID_TYPE ``` #### Type + String --- @@ -92,9 +107,11 @@ String ### `REQUEST_TYPES` #### Signature + ```apex public static final REQUEST_TYPES ``` #### Type -Set<String> \ No newline at end of file + +Set<String> diff --git a/docs/trigger-actions-framework/TriggerActionFlow.md b/docs/trigger-actions-framework/TriggerActionFlow.md index cc43fbf..c857661 100644 --- a/docs/trigger-actions-framework/TriggerActionFlow.md +++ b/docs/trigger-actions-framework/TriggerActionFlow.md @@ -1,32 +1,36 @@ # TriggerActionFlow Class + `virtual` `SUPPRESSWARNINGS` -This class implements the TriggerAction interface and provides a framework for +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.BeforeInsert, +TriggerAction.AfterInsert, +TriggerAction.BeforeUpdate, +TriggerAction.AfterUpdate, +TriggerAction.BeforeDelete, +TriggerAction.AfterDelete, TriggerAction.AfterUndelete ## Fields + ### `flowName` #### Signature + ```apex public flowName ``` #### Type + String --- @@ -34,29 +38,35 @@ 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 | -|------|------|-------------| + +| Name | Type | Description | +| -------- | ------ | ----------------------------------- | | flowName | String | The API name of the Flow to bypass. | #### Return Type + **void** --- @@ -66,16 +76,19 @@ public static void bypass(String flowName) This method clears the bypass for the specified list of records. #### Signature + ```apex public static void clearBypass(String flowName) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| -------- | ------ | ------------------------------------------------- | | flowName | String | The API name of the Flow to clear the bypass for. | #### Return Type + **void** --- @@ -85,16 +98,19 @@ public static void clearBypass(String 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 | -|------|------|-------------| + +| 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. @@ -106,11 +122,13 @@ public static Boolean isBypassed(String flowName) This method clears all bypasses for all Flows. #### Signature + ```apex public static void clearAllBypasses() ``` #### Return Type + **void** --- @@ -120,19 +138,23 @@ public static void clearAllBypasses() This method validates the specified bypass type. #### Signature + ```apex public static void validateType(String bypassType) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------ | ---------------------------- | | bypassType | String | The bypass type to validate. | #### Return Type + **void** #### Throws + IllegalArgumentException: if the bypass type is not valid. --- @@ -142,16 +164,19 @@ IllegalArgumentException: if the bypass type is not valid. This method executes the Flow for the specified list of records before the insert of the records. #### Signature + ```apex public void beforeInsert(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------------- | | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type + **void** --- @@ -161,16 +186,19 @@ public void beforeInsert(List triggerNew) This method executes the Flow for the specified list of records after the insert of the records. #### Signature + ```apex public void afterInsert(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------------- | | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type + **void** --- @@ -180,17 +208,20 @@ public void afterInsert(List triggerNew) This method executes the Flow for the specified list of records before the update of the records. #### Signature + ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type + **void** --- @@ -200,17 +231,20 @@ public void beforeUpdate(List triggerNew, List triggerOld) This method executes the Flow for the specified list of records after the update of the records. #### Signature + ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type + **void** --- @@ -220,16 +254,19 @@ public void afterUpdate(List triggerNew, List triggerOld) This method executes the Flow for the specified list of records before the delete of the records. #### Signature + ```apex public void beforeDelete(List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type + **void** --- @@ -239,16 +276,19 @@ public void beforeDelete(List triggerOld) This method executes the Flow for the specified list of records after the delete of the records. #### Signature + ```apex public void afterDelete(List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type + **void** --- @@ -258,14 +298,17 @@ public void afterDelete(List triggerOld) This method executes the Flow for the specified list of records before the undelete of the records. #### Signature + ```apex public void afterUndelete(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------------- | | triggerNew | List<SObject> | The list of records that are being restored. | #### Return Type -**void** \ No newline at end of file + +**void** diff --git a/docs/trigger-actions-framework/TriggerActionFlowAddError.md b/docs/trigger-actions-framework/TriggerActionFlowAddError.md index 21b9c43..3356e9f 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowAddError.md +++ b/docs/trigger-actions-framework/TriggerActionFlowAddError.md @@ -1,21 +1,22 @@ # 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. - ---- - +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` @@ -23,34 +24,41 @@ If the `fieldName` property is not specified, the error message will be added to This Invocable method adds an error to an sObject. #### Signature + ```apex public static void addError(List requests) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| 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 --- @@ -60,11 +68,13 @@ SObject `INVOCABLEVARIABLE` ###### Signature + ```apex public fieldName ``` ###### Type + String --- @@ -74,9 +84,11 @@ String `INVOCABLEVARIABLE` ###### Signature + ```apex public errorMessage ``` ###### Type -String \ No newline at end of file + +String diff --git a/docs/trigger-actions-framework/TriggerActionFlowBypass.md b/docs/trigger-actions-framework/TriggerActionFlowBypass.md index 3529b5e..16608f7 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowBypass.md +++ b/docs/trigger-actions-framework/TriggerActionFlowBypass.md @@ -2,17 +2,18 @@ `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. +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` @@ -20,34 +21,41 @@ Each `Request` object contains the following properties: 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 | -|------|------|-------------| + +| 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 --- @@ -57,9 +65,11 @@ String `INVOCABLEVARIABLE` ###### Signature + ```apex public bypassType ``` ###### Type -String \ No newline at end of file + +String diff --git a/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md b/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md index 72b4a22..54fccee 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md +++ b/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md @@ -1,31 +1,36 @@ # 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 +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 | -|------|------|-------------| + +| 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. | +| 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 + +**void** diff --git a/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md b/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md index ecc0bfa..83e9659 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md +++ b/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md @@ -1,15 +1,15 @@ # 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 +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 @@ -19,92 +19,107 @@ as the input variable. [TriggerActionFlow](TriggerActionFlow.md) ## Fields + ### `flowName` -*Inherited* +_Inherited_ #### Signature + ```apex public flowName ``` #### Type + String --- ### `allowRecursion` -*Inherited* +_Inherited_ #### Signature + ```apex public allowRecursion ``` #### Type + Boolean ## Methods + ### `bypass(flowName)` -*Inherited* +_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 | -|------|------|-------------| + +| Name | Type | Description | +| -------- | ------ | ----------------------------------- | | flowName | String | The API name of the Flow to bypass. | #### Return Type + **void** --- ### `clearBypass(flowName)` -*Inherited* +_Inherited_ This method clears the bypass for the specified list of records. #### Signature + ```apex public static void clearBypass(String flowName) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| -------- | ------ | ------------------------------------------------- | | flowName | String | The API name of the Flow to clear the bypass for. | #### Return Type + **void** --- ### `isBypassed(flowName)` -*Inherited* +_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 | -|------|------|-------------| + +| 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. @@ -113,187 +128,214 @@ public static Boolean isBypassed(String flowName) ### `clearAllBypasses()` -*Inherited* +_Inherited_ This method clears all bypasses for all Flows. #### Signature + ```apex public static void clearAllBypasses() ``` #### Return Type + **void** --- ### `validateType(bypassType)` -*Inherited* +_Inherited_ This method validates the specified bypass type. #### Signature + ```apex public static void validateType(String bypassType) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------ | ---------------------------- | | bypassType | String | The bypass type to validate. | #### Return Type + **void** #### Throws + IllegalArgumentException: if the bypass type is not valid. --- ### `beforeInsert(triggerNew)` -*Inherited* +_Inherited_ This method executes the Flow for the specified list of records before the insert of the records. #### Signature + ```apex public void beforeInsert(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------------- | | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type + **void** --- ### `afterInsert(triggerNew)` -*Inherited* +_Inherited_ This method executes the Flow for the specified list of records after the insert of the records. #### Signature + ```apex public void afterInsert(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------------- | | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type + **void** --- ### `beforeUpdate(triggerNew, triggerOld)` -*Inherited* +_Inherited_ This method executes the Flow for the specified list of records before the update of the records. #### Signature + ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type + **void** --- ### `afterUpdate(triggerNew, triggerOld)` -*Inherited* +_Inherited_ This method executes the Flow for the specified list of records after the update of the records. #### Signature + ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type + **void** --- ### `beforeDelete(triggerOld)` -*Inherited* +_Inherited_ This method executes the Flow for the specified list of records before the delete of the records. #### Signature + ```apex public void beforeDelete(List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type + **void** --- ### `afterDelete(triggerOld)` -*Inherited* +_Inherited_ This method executes the Flow for the specified list of records after the delete of the records. #### Signature + ```apex public void afterDelete(List triggerOld) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | ----------------------------------------------- | | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type + **void** --- ### `afterUndelete(triggerNew)` -*Inherited* +_Inherited_ This method executes the Flow for the specified list of records before the undelete of the records. #### Signature + ```apex public void afterUndelete(List triggerNew) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ---------- | ------------------- | -------------------------------------------- | | triggerNew | List<SObject> | The list of records that are being restored. | #### Return Type -**void** \ No newline at end of file + +**void** diff --git a/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md b/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md index 9149b69..cfb820f 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md +++ b/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md @@ -2,20 +2,21 @@ `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 + ### `clearAllBypasses(requests)` `INVOCABLEMETHOD` @@ -23,14 +24,17 @@ The `clearAllBypasses` method will clear all bypasses for the specified objects, This method clears all bypasses for the specified objects, Apex actions, or Flow actions. #### Signature + ```apex public static void clearAllBypasses(List requests) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| 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 + +**void** diff --git a/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md b/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md index dd8d049..69c977c 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md +++ b/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md @@ -2,20 +2,21 @@ `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 `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` @@ -23,40 +24,47 @@ The `clearBypass` method will clear the bypass for the specified objects, Apex a 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 | -|------|------|-------------| + +| 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. +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 --- @@ -66,9 +74,11 @@ String `INVOCABLEVARIABLE` ###### Signature + ```apex public bypassType ``` ###### Type -String \ No newline at end of file + +String diff --git a/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md b/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md index 8f57ff6..c7989d8 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md +++ b/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md @@ -2,67 +2,75 @@ `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 +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, +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 | -|------|------|-------------| + +| 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. +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 --- @@ -72,9 +80,11 @@ String `INVOCABLEVARIABLE` ###### Signature + ```apex public bypassType ``` ###### Type -String \ No newline at end of file + +String diff --git a/docs/trigger-actions-framework/TriggerBase.md b/docs/trigger-actions-framework/TriggerBase.md index 77efa76..6caa127 100644 --- a/docs/trigger-actions-framework/TriggerBase.md +++ b/docs/trigger-actions-framework/TriggerBase.md @@ -1,71 +1,83 @@ # 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 `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` +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 +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 | -|------|------|-------------| + +| Name | Type | Description | +| ----------- | ------ | ------------------------------------- | | sObjectName | String | The API name of the object to bypass. | #### Return Type + **void** --- @@ -75,16 +87,19 @@ public static void bypass(String sObjectName) This method clears the bypass for the specified object. #### Signature + ```apex public static void clearBypass(String sObjectName) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| Name | Type | Description | +| ----------- | ------ | --------------------------------------------------- | | sObjectName | String | The API name of the object to clear the bypass for. | #### Return Type + **void** --- @@ -94,16 +109,19 @@ public static void clearBypass(String sObjectName) This method checks if the specified object is bypassed. #### Signature + ```apex public static Boolean isBypassed(String sObjectName) ``` #### Parameters -| Name | Type | Description | -|------|------|-------------| + +| 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. @@ -115,11 +133,13 @@ True if the object is bypassed, false otherwise. This method clears all bypasses. #### Signature + ```apex public static void clearAllBypasses() ``` #### Return Type + **void** --- @@ -129,11 +149,13 @@ public static void clearAllBypasses() This method offsets the number of existing DML rows. #### Signature + ```apex public static void offsetExistingDmlRows() ``` #### Return Type + **void** --- @@ -143,11 +165,13 @@ public static void offsetExistingDmlRows() This method waits to finalize the DML operation. #### Signature + ```apex public static void waitToFinalize() ``` #### Return Type + **void** --- @@ -157,11 +181,13 @@ public static void waitToFinalize() This method now finalizes the DML operation. #### Signature + ```apex public static void nowFinalize() ``` #### Return Type + **void** --- @@ -171,9 +197,11 @@ public static void nowFinalize() This method runs the trigger handler. #### Signature + ```apex public void run() ``` #### Return Type -**void** \ No newline at end of file + +**void** diff --git a/docs/trigger-actions-framework/TriggerTestUtility.md b/docs/trigger-actions-framework/TriggerTestUtility.md index 5783ba3..fbc9c03 100644 --- a/docs/trigger-actions-framework/TriggerTestUtility.md +++ b/docs/trigger-actions-framework/TriggerTestUtility.md @@ -2,31 +2,35 @@ `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: - +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 | -|------|------|-------------| + +| 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 +A fake ID for the specified sObject type. diff --git a/package.json b/package.json index 4bc23b9..61617d0 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,33 @@ { - "name": "apex-trigger-actions-framework", - "private": true, - "version": "1.0.0", - "description": "Apex Trigger Actions Framework", - "scripts": { - "prepare": "husky", - "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,yaml,yml}\"", - "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,yaml,yml}\"" - }, - "devDependencies": { - "@prettier/plugin-xml": "^3.4.1", - "eslint": "^9.22.0", - "eslint-config-prettier": "^10.1.1", - "husky": "^9.1.7", - "lint-staged": "^15.5.0", - "prettier": "3.5.3", - "prettier-plugin-apex": "2.2.5" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ - "prettier --write" - ], - "**/{aura|lwc}/**": ["eslint"] - } + "name": "apex-trigger-actions-framework", + "private": true, + "version": "1.0.0", + "description": "Apex Trigger Actions Framework", + "scripts": { + "prepare": "husky", + "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", + "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"" + }, + "devDependencies": { + "@prettier/plugin-xml": "^3.4.1", + "eslint": "^9.22.0", + "eslint-config-prettier": "^10.1.1", + "husky": "^9.1.7", + "lint-staged": "^15.5.0", + "prettier": "3.5.3", + "prettier-plugin-apex": "2.2.5" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ + "prettier --write" + ], + "**/{aura|lwc}/**": [ + "eslint" + ] + } } diff --git a/sfdx-project.json b/sfdx-project.json index 1422e07..b333369 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -1,48 +1,48 @@ { - "packageDirectories": [ - { - "path": "trigger-actions-framework", - "default": true, - "package": "Trigger Actions Framework", - "versionName": "Version 0.3", - "versionNumber": "0.3.1.NEXT" - } - ], - "namespace": "", - "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "63.0", - "packageAliases": { - "Trigger Actions Framework": "0Ho3h0000008Om4CAE", - "Trigger Actions Framework@0.1.0-1": "04t3h000004VaHaAAK", - "Trigger Actions Framework@0.1.2": "04t3h000004VaIdAAK", - "Trigger Actions Framework@0.1.3": "04t3h000004VaInAAK", - "Trigger Actions Framework@0.1.4-0": "04t3h000004VaJWAA0", - "Trigger Actions Framework@0.1.4-1": "04t3h000004VaJbAAK", - "Trigger Actions Framework@0.1.5-0": "04t3h000004VaJqAAK", - "Trigger Actions Framework@0.1.6": "04t3h000004VaLDAA0", - "Trigger Actions Framework@0.1.7": "04t3h000004VaLIAA0", - "Trigger Actions Framework@0.1.8": "04t3h000004VaLNAA0", - "Trigger Actions Framework@0.1.9": "04t3h000004VaLSAA0", - "Trigger Actions Framework@0.2.0": "04t3h000004VaLmAAK", - "Trigger Actions Framework@0.2.1": "04t3h000004VaVFAA0", - "Trigger Actions Framework@0.2.2-1": "04t3h000004OYREAA4", - "Trigger Actions Framework@0.2.3-1": "04t3h000004OYTKAA4", - "Trigger Actions Framework@0.2.5-1": "04t3h000004OYUDAA4", - "Trigger Actions Framework@0.2.6-1": "04t3h000004juLaAAI", - "Trigger Actions Framework@0.2.8": "04t3h000004juLuAAI", - "Trigger Actions Framework@0.2.9": "04t3h000004juNCAAY", - "Trigger Actions Framework@0.2.9-1": "04t3h000004juNHAAY", - "Trigger Actions Framework@0.2.10": "04t3h000004juNRAAY", - "Trigger Actions Framework@0.2.11": "04tKY000000Pb8tYAC", - "Trigger Actions Framework@0.3.0": "04tKY000000Pb8ZYAS", - "Trigger Actions Framework@0.3.1-0": "04tKY000000Pd90YAC", - "Trigger Actions Framework@0.3.1-1": "04tKY000000Pd95YAC", - "Trigger Actions Framework@0.3.1-2": "04tKY000000Pd9AYAS", - "Trigger Actions Framework@0.3.1-3": "04tKY000000PdYBYA0", - "Trigger Actions Framework@0.3.1-4": "04tKY000000PdYGYA0", - "Trigger Actions Framework@0.3.1-5": "04tKY000000PdYaYAK", - "Trigger Actions Framework@0.3.1-6": "04tKY000000PdZ9YAK", - "Trigger Actions Framework@0.3.1-7": "04tKY000000PdZJYA0", - "Trigger Actions Framework@0.3.2": "04tKY000000PdZOYA0" - } -} \ No newline at end of file + "packageDirectories": [ + { + "path": "trigger-actions-framework", + "default": true, + "package": "Trigger Actions Framework", + "versionName": "Version 0.3", + "versionNumber": "0.3.1.NEXT" + } + ], + "namespace": "", + "sfdcLoginUrl": "https://login.salesforce.com", + "sourceApiVersion": "63.0", + "packageAliases": { + "Trigger Actions Framework": "0Ho3h0000008Om4CAE", + "Trigger Actions Framework@0.1.0-1": "04t3h000004VaHaAAK", + "Trigger Actions Framework@0.1.2": "04t3h000004VaIdAAK", + "Trigger Actions Framework@0.1.3": "04t3h000004VaInAAK", + "Trigger Actions Framework@0.1.4-0": "04t3h000004VaJWAA0", + "Trigger Actions Framework@0.1.4-1": "04t3h000004VaJbAAK", + "Trigger Actions Framework@0.1.5-0": "04t3h000004VaJqAAK", + "Trigger Actions Framework@0.1.6": "04t3h000004VaLDAA0", + "Trigger Actions Framework@0.1.7": "04t3h000004VaLIAA0", + "Trigger Actions Framework@0.1.8": "04t3h000004VaLNAA0", + "Trigger Actions Framework@0.1.9": "04t3h000004VaLSAA0", + "Trigger Actions Framework@0.2.0": "04t3h000004VaLmAAK", + "Trigger Actions Framework@0.2.1": "04t3h000004VaVFAA0", + "Trigger Actions Framework@0.2.2-1": "04t3h000004OYREAA4", + "Trigger Actions Framework@0.2.3-1": "04t3h000004OYTKAA4", + "Trigger Actions Framework@0.2.5-1": "04t3h000004OYUDAA4", + "Trigger Actions Framework@0.2.6-1": "04t3h000004juLaAAI", + "Trigger Actions Framework@0.2.8": "04t3h000004juLuAAI", + "Trigger Actions Framework@0.2.9": "04t3h000004juNCAAY", + "Trigger Actions Framework@0.2.9-1": "04t3h000004juNHAAY", + "Trigger Actions Framework@0.2.10": "04t3h000004juNRAAY", + "Trigger Actions Framework@0.2.11": "04tKY000000Pb8tYAC", + "Trigger Actions Framework@0.3.0": "04tKY000000Pb8ZYAS", + "Trigger Actions Framework@0.3.1-0": "04tKY000000Pd90YAC", + "Trigger Actions Framework@0.3.1-1": "04tKY000000Pd95YAC", + "Trigger Actions Framework@0.3.1-2": "04tKY000000Pd9AYAS", + "Trigger Actions Framework@0.3.1-3": "04tKY000000PdYBYA0", + "Trigger Actions Framework@0.3.1-4": "04tKY000000PdYGYA0", + "Trigger Actions Framework@0.3.1-5": "04tKY000000PdYaYAK", + "Trigger Actions Framework@0.3.1-6": "04tKY000000PdZ9YAK", + "Trigger Actions Framework@0.3.1-7": "04tKY000000PdZJYA0", + "Trigger Actions Framework@0.3.2": "04tKY000000PdZOYA0" + } +} diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls index 61b81f4..8d9c274 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls +++ b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls @@ -121,10 +121,7 @@ public with sharing virtual class FinalizerHandler { * @param finalizerMetadata The metadata of the finalizer to execute. * @param context The context to pass to the finalizer's `execute` method. */ - private void callReferencedFinalizer( - DML_Finalizer__mdt finalizerMetadata, - Context context - ) { + private void callReferencedFinalizer(DML_Finalizer__mdt finalizerMetadata, Context context) { Object dynamicInstance; String className = finalizerMetadata.Apex_Class_Name__c; if (FinalizerHandler.isBypassed(className)) { @@ -166,9 +163,7 @@ public with sharing virtual class FinalizerHandler { } private void handleFinalizerException(String errorFormat, String className) { - throw new FinalizerException( - String.format(errorFormat, new List{ className }) - ); + throw new FinalizerException(String.format(errorFormat, new List{ className })); } /** @@ -178,10 +173,7 @@ public with sharing virtual class FinalizerHandler { * @param requiredPermission The required permission for the finalizer. * @return True if bypassed, false otherwise. */ - private boolean isBypassed( - String bypassPermission, - String requiredPermission - ) { + private boolean isBypassed(String bypassPermission, String requiredPermission) { return (bypassPermission != null && permissionMap.get(bypassPermission)) || (requiredPermission != null && !permissionMap.get(requiredPermission)); } @@ -192,10 +184,7 @@ public with sharing virtual class FinalizerHandler { */ private void populatePermissionMap(String permissionName) { if (permissionName != null && !permissionMap.containsKey(permissionName)) { - permissionMap.put( - permissionName, - FeatureManagement.checkPermission(permissionName) - ); + permissionMap.put(permissionName, FeatureManagement.checkPermission(permissionName)); } } @@ -231,8 +220,7 @@ public with sharing virtual class FinalizerHandler { * equal to, or greater than the specified object. */ public Integer compareTo(Object other) { - Decimal difference = (this.metadata.Order__c - - ((FinalizerSorter) other).metadata.Order__c); + Decimal difference = (this.metadata.Order__c - ((FinalizerSorter) other).metadata.Order__c); return difference < 0 ? -1 : difference == 0 ? 0 : 1; } } @@ -249,4 +237,4 @@ public with sharing virtual class FinalizerHandler { */ private class FinalizerException extends Exception { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls index 637fbb8..1c89cc7 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls +++ b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls @@ -94,10 +94,7 @@ private with sharing class FinalizerHandlerTest { @IsTest private static void staticallyBypassedFinalizerShouldNotExecute() { handler.allFinalizers = new List{ - new DML_Finalizer__mdt( - Apex_Class_Name__c = TEST_FOO_FINALIZER, - Order__c = 1 - ) + new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_FOO_FINALIZER, Order__c = 1) }; FinalizerHandler.bypass(TEST_FOO_FINALIZER); @@ -150,14 +147,8 @@ private with sharing class FinalizerHandlerTest { @IsTest private static void finalizersShouldExecuteInOrder() { handler.allFinalizers = new List{ - new DML_Finalizer__mdt( - Apex_Class_Name__c = TEST_FOO_FINALIZER, - Order__c = 1 - ), - new DML_Finalizer__mdt( - Apex_Class_Name__c = TEST_BAR_FINALIZER, - Order__c = 2 - ) + new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_FOO_FINALIZER, Order__c = 1), + new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_BAR_FINALIZER, Order__c = 2) }; handler.handleDynamicFinalizers(); @@ -213,10 +204,7 @@ private with sharing class FinalizerHandlerTest { System.Assert.isNotNull(myException, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format( - FinalizerHandler.INVALID_TYPE_ERROR_FINALIZER, - new List{ MY_CLASS } - ), + String.format(FinalizerHandler.INVALID_TYPE_ERROR_FINALIZER, new List{ MY_CLASS }), myException.getMessage(), EXCEPTION_SHOULD_HAVE_CORRECT_MESSAGE ); @@ -307,4 +295,4 @@ private with sharing class FinalizerHandlerTest { Database.setSavepoint(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls index 6a28a43..a72ae1c 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls @@ -113,4 +113,4 @@ public with sharing class FlowChangeEventHeader { public Integer hashCode() { return JSON.serialize(this).hashCode(); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls index 32db838..2cf5e7d 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls @@ -23,10 +23,7 @@ private with sharing class FlowChangeEventHeaderTest { @IsTest private static void shouldBeAbleToConstruct() { - System.Assert.isNotNull( - header, - 'Unable to construct a FlowChangeEventHeader' - ); + System.Assert.isNotNull(header, 'Unable to construct a FlowChangeEventHeader'); } @IsTest @@ -36,9 +33,7 @@ private with sharing class FlowChangeEventHeaderTest { @IsTest private static void shouldBeAbleToCompare() { - FlowChangeEventHeader other = new FlowChangeEventHeader( - new EventBus.ChangeEventHeader() - ); + FlowChangeEventHeader other = new FlowChangeEventHeader(new EventBus.ChangeEventHeader()); other.changeType = 'CREATE'; System.Assert.areEqual( @@ -57,4 +52,4 @@ private with sharing class FlowChangeEventHeaderTest { 'Unable to detect difference between FlowChangeEventHeader and null' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/FormulaFilter.cls b/trigger-actions-framework/main/default/classes/FormulaFilter.cls index 842eda5..37dd400 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilter.cls +++ b/trigger-actions-framework/main/default/classes/FormulaFilter.cls @@ -23,8 +23,7 @@ global class FormulaFilter { private static final String ERROR_PREFIX = 'Please check the `SObject_Trigger_Setting__mdt` metadata for the the {0} sObject.'; @TestVisible private static final String MISSING_CLASS_NAME = - ERROR_PREFIX + - ' The record is missing the `TriggerRecord_Class_Name__c` field.'; + ERROR_PREFIX + ' The record is missing the `TriggerRecord_Class_Name__c` field.'; @TestVisible private static final String INVALID_CLASS = ERROR_PREFIX + @@ -74,18 +73,14 @@ global class FormulaFilter { List triggerOld ) { FormulaFilter.Result result = new FormulaFilter.Result(); - String entryCriteriaFormula = this.triggerActionConfiguration - ?.Entry_Criteria__c; + String entryCriteriaFormula = this.triggerActionConfiguration?.Entry_Criteria__c; if (String.isBlank(entryCriteriaFormula)) { result.triggerNew = triggerNew; result.triggerOld = triggerOld; return result; } - String nameOfType = getNameOfType( - this.triggerActionConfiguration, - this.context - ); + String nameOfType = getNameOfType(this.triggerActionConfiguration, this.context); System.Type triggerRecordSubType = getType(nameOfType); FormulaEval.FormulaInstance fx = getFormulaInstance( triggerRecordSubType, @@ -97,10 +92,7 @@ global class FormulaFilter { for (Integer i = 0; i < size; i++) { SObject record = triggerNew?.get(i); SObject recordPrior = triggerOld?.get(i); - TriggerRecord toProcess = getTriggerRecord( - triggerRecordSubType, - nameOfType - ); + TriggerRecord toProcess = getTriggerRecord(triggerRecordSubType, nameOfType); toProcess.newSobject = record; toProcess.oldSobject = recordPrior; if ((Boolean) fx.evaluate(toProcess)) { @@ -120,28 +112,19 @@ global class FormulaFilter { System.Type response = System.Type.forName(className); if (response == null) { throw new IllegalArgumentException( - String.format( - INVALID_CLASS, - new List{ this.sObjectName, className } - ) + String.format(INVALID_CLASS, new List{ this.sObjectName, className }) ); } return response; } - private TriggerRecord getTriggerRecord( - System.Type triggerRecordSubType, - String nameOfType - ) { + private TriggerRecord getTriggerRecord(System.Type triggerRecordSubType, String nameOfType) { TriggerRecord dynamicInstance; try { dynamicInstance = (TriggerRecord) triggerRecordSubType.newInstance(); } catch (System.TypeException e) { throw new IllegalArgumentException( - String.format( - INVALID_SUBTYPE, - new List{ this.sObjectName, nameOfType } - ) + String.format(INVALID_SUBTYPE, new List{ this.sObjectName, nameOfType }) ); } return dynamicInstance; @@ -204,4 +187,4 @@ global class FormulaFilter { this.triggerOld = new List(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml b/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls index 478d9be..6ed1d4d 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls +++ b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls @@ -13,9 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -@SuppressWarnings( - 'PMD.ApexUnitTestClassShouldHaveRunAs, PMD.AvoidGlobalModifier' -) +@SuppressWarnings('PMD.ApexUnitTestClassShouldHaveRunAs, PMD.AvoidGlobalModifier') @IsTest global class FormulaFilterTest { private static final String ACCOUNT_SOBJECT_NAME = 'Account'; @@ -45,21 +43,10 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); - System.Assert.areEqual( - 2, - result.triggerNew.size(), - 'The size of triggerNew should be 2' - ); - System.Assert.areEqual( - 2, - result.triggerOld.size(), - 'The size of triggerOld should be 2' - ); + System.Assert.areEqual(2, result.triggerNew.size(), 'The size of triggerNew should be 2'); + System.Assert.areEqual(2, result.triggerOld.size(), 'The size of triggerOld should be 2'); } @IsTest @@ -72,21 +59,10 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); - System.Assert.areEqual( - 2, - result.triggerNew.size(), - 'The size of triggerNew should be 2' - ); - System.Assert.areEqual( - 2, - result.triggerOld.size(), - 'The size of triggerNew should be 2' - ); + System.Assert.areEqual(2, result.triggerNew.size(), 'The size of triggerNew should be 2'); + System.Assert.areEqual(2, result.triggerOld.size(), 'The size of triggerNew should be 2'); } @IsTest @@ -98,26 +74,15 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); - System.Assert.areEqual( - 1, - result.triggerNew.size(), - 'There should be 1 record in triggerNew' - ); + System.Assert.areEqual(1, result.triggerNew.size(), 'There should be 1 record in triggerNew'); System.Assert.areEqual( 'Test Account 1', ((Account) result.triggerNew[0]).Name, 'The first record triggerNew should have a name of Test Account 1' ); - System.Assert.areEqual( - 1, - result.triggerOld.size(), - 'There should be 1 record in triggerNew' - ); + System.Assert.areEqual(1, result.triggerOld.size(), 'There should be 1 record in triggerNew'); System.Assert.areEqual( 'Test Account 1', ((Account) result.triggerOld[0]).Name, @@ -134,20 +99,11 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); System.Assert.isNotNull(result, 'result should not be null'); - System.Assert.isTrue( - result.triggerNew.isEmpty(), - 'triggerNew should be empty' - ); - System.Assert.isTrue( - result.triggerOld.isEmpty(), - 'triggerOld should be empty' - ); + System.Assert.isTrue(result.triggerNew.isEmpty(), 'triggerNew should be empty'); + System.Assert.isTrue(result.triggerOld.isEmpty(), 'triggerOld should be empty'); } @IsTest @@ -168,10 +124,7 @@ global class FormulaFilterTest { System.Assert.isNotNull(caught, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format( - FormulaFilter.MISSING_CLASS_NAME, - new List{ ACCOUNT_SOBJECT_NAME } - ), + String.format(FormulaFilter.MISSING_CLASS_NAME, new List{ ACCOUNT_SOBJECT_NAME }), caught.getMessage(), 'The exception message should match the expected error' ); @@ -195,10 +148,7 @@ global class FormulaFilterTest { System.Assert.isNotNull(caught, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format( - FormulaFilter.MISSING_CLASS_NAME, - new List{ ACCOUNT_SOBJECT_NAME } - ), + String.format(FormulaFilter.MISSING_CLASS_NAME, new List{ ACCOUNT_SOBJECT_NAME }), caught.getMessage(), 'The exception message should match the expected error' ); @@ -256,10 +206,7 @@ global class FormulaFilterTest { System.Assert.areEqual( String.format( FormulaFilter.INVALID_SUBTYPE, - new List{ - ACCOUNT_SOBJECT_NAME, - sobjectSetting.TriggerRecord_Class_Name__c - } + new List{ ACCOUNT_SOBJECT_NAME, sobjectSetting.TriggerRecord_Class_Name__c } ), caught.getMessage(), 'The exception message should match the expected error' @@ -285,10 +232,7 @@ global class FormulaFilterTest { System.Assert.areEqual( String.format( FormulaFilter.INVALID_CLASS, - new List{ - ACCOUNT_SOBJECT_NAME, - sobjectSetting.TriggerRecord_Class_Name__c - } + new List{ ACCOUNT_SOBJECT_NAME, sobjectSetting.TriggerRecord_Class_Name__c } ), caught.getMessage(), 'The exception message should match the expected error' @@ -368,4 +312,4 @@ global class FormulaFilterTest { } } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls index a4fa549..04e4a34 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls @@ -235,10 +235,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private void populatePermissionMap(String permissionName) { if (permissionName != null && !permissionMap.containsKey(permissionName)) { - permissionMap.put( - permissionName, - FeatureManagement.checkPermission(permissionName) - ); + permissionMap.put(permissionName, FeatureManagement.checkPermission(permissionName)); } } @@ -250,15 +247,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private list getActionMetadata(String relationshipName) { if (!sObjectToContextToActions.containsKey(this.sObjectName)) { - sObjectToContextToActions.put( - this.sObjectName, - new Map>() - ); + sObjectToContextToActions.put(this.sObjectName, new Map>()); } - if ( - !sObjectToContextToActions.get(this.sObjectName) - .containsKey(relationshipName) - ) { + if (!sObjectToContextToActions.get(this.sObjectName).containsKey(relationshipName)) { list result = new List(); String sObjectLocalName = this.sObjectName; List split = sObjectName.split(DOUBLE_UNDERSCORE); @@ -279,20 +270,16 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem } ); for ( - Trigger_Action__mdt actionMetadata : (List) selector.query( - queryString - ) + Trigger_Action__mdt actionMetadata : (List) selector.query(queryString) ) { if (shouldExecute(actionMetadata, relationshipName)) { result.add(actionMetadata); } } - sObjectToContextToActions.get(this.sObjectName) - .put(relationshipName, result); + sObjectToContextToActions.get(this.sObjectName).put(relationshipName, result); } - return sObjectToContextToActions.get(this.sObjectName) - .get(relationshipName); + return sObjectToContextToActions.get(this.sObjectName).get(relationshipName); } /** @@ -302,10 +289,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param relationshipName The name of the relationship. * @return True if the Trigger Action should be executed, false otherwise. */ - private Boolean shouldExecute( - Trigger_Action__mdt actionMetadata, - String relationshipName - ) { + private Boolean shouldExecute(Trigger_Action__mdt actionMetadata, String relationshipName) { String sObjectBypassPermissionName = (String) ((sObject_Trigger_Setting__mdt) actionMetadata.getSobject( relationshipName + RELATIONSHIP_SUFFIX )) @@ -328,8 +312,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem return !isBypassed( actionMetadata.Bypass_Permission__c, actionMetadata.Required_Permission__c - ) && - !isBypassed(sObjectBypassPermissionName, sObjectRequiredPermissionName); + ) && !isBypassed(sObjectBypassPermissionName, sObjectRequiredPermissionName); } /** @@ -339,10 +322,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param requiredPermission The required permission for the Trigger Action. * @return True if bypassed, false otherwise. */ - private static boolean isBypassed( - String bypassPermission, - String requiredPermission - ) { + private static boolean isBypassed(String bypassPermission, String requiredPermission) { return (bypassPermission != null && permissionMap.get(bypassPermission)) || (requiredPermission != null && !permissionMap.get(requiredPermission)); } @@ -364,16 +344,8 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem if (!canExecute(triggerMetadata)) { continue; } - this.validateType( - context, - triggerAction, - triggerMetadata.Apex_Class_Name__c - ); - FormulaFilter.Result filtered = new FormulaFilter( - triggerMetadata, - context, - this.sObjectName - ) + this.validateType(context, triggerAction, triggerMetadata.Apex_Class_Name__c); + FormulaFilter.Result filtered = new FormulaFilter(triggerMetadata, context, this.sObjectName) .filterByEntryCriteria(triggerNew, triggerOld); if ( @@ -387,12 +359,10 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem switch on context { when BEFORE_INSERT { - ((TriggerAction.BeforeInsert) triggerAction) - .beforeInsert(filtered.triggerNew); + ((TriggerAction.BeforeInsert) triggerAction).beforeInsert(filtered.triggerNew); } when AFTER_INSERT { - ((TriggerAction.AfterInsert) triggerAction) - .afterInsert(filtered.triggerNew); + ((TriggerAction.AfterInsert) triggerAction).afterInsert(filtered.triggerNew); } when BEFORE_UPDATE { ((TriggerAction.BeforeUpdate) triggerAction) @@ -403,16 +373,13 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem .afterUpdate(filtered.triggerNew, filtered.triggerOld); } when BEFORE_DELETE { - ((TriggerAction.BeforeDelete) triggerAction) - .beforeDelete(filtered.triggerOld); + ((TriggerAction.BeforeDelete) triggerAction).beforeDelete(filtered.triggerOld); } when AFTER_DELETE { - ((TriggerAction.AfterDelete) triggerAction) - .afterDelete(filtered.triggerOld); + ((TriggerAction.AfterDelete) triggerAction).afterDelete(filtered.triggerOld); } when AFTER_UNDELETE { - ((TriggerAction.AfterUndelete) triggerAction) - .afterUndelete(filtered.triggerNew); + ((TriggerAction.AfterUndelete) triggerAction).afterUndelete(filtered.triggerNew); } } } @@ -425,9 +392,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param context The TriggerOperation context for which to retrieve metadata. * @return A List of Trigger_Action__mdt metadata records corresponding to the given context. */ - private List getActionMetadata( - TriggerOperation context - ) { + private List getActionMetadata(TriggerOperation context) { List result; switch on context { when BEFORE_INSERT { @@ -474,15 +439,10 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem result = Type.forName(triggerMetadata.Apex_Class_Name__c).newInstance(); if (triggerMetadata.Flow_Name__c != null) { ((TriggerActionFlow) result).flowName = triggerMetadata.Flow_Name__c; - ((TriggerActionFlow) result) - .allowRecursion = triggerMetadata.Allow_Flow_Recursion__c; + ((TriggerActionFlow) result).allowRecursion = triggerMetadata.Allow_Flow_Recursion__c; } } catch (System.NullPointerException e) { - handleException( - INVALID_CLASS_ERROR, - triggerMetadata.Apex_Class_Name__c, - context - ); + handleException(INVALID_CLASS_ERROR, triggerMetadata.Apex_Class_Name__c, context); } return result; } @@ -496,9 +456,8 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @return True if the trigger action can be executed, false otherwise. */ private Boolean canExecute(Trigger_Action__mdt triggerMetadata) { - return !MetadataTriggerHandler.isBypassed( - triggerMetadata.Apex_Class_Name__c - ) && !TriggerBase.isBypassed(this.sObjectName); + return !MetadataTriggerHandler.isBypassed(triggerMetadata.Apex_Class_Name__c) && + !TriggerBase.isBypassed(this.sObjectName); } /** @@ -508,11 +467,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param triggerAction The Trigger Action object. * @param className The name of the Trigger Action class. */ - private void validateType( - TriggerOperation context, - Object triggerAction, - String className - ) { + private void validateType(TriggerOperation context, Object triggerAction, String className) { try { switch on context { when BEFORE_INSERT { @@ -549,19 +504,11 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param className The name of the Trigger Action class. * @param triggerOperation The Trigger Operation context. */ - private void handleException( - String error, - String className, - TriggerOperation triggerOperation - ) { + private void handleException(String error, String className, TriggerOperation triggerOperation) { throw new MetadataTriggerHandlerException( String.format( error, - new List{ - className, - String.valueOf(triggerOperation), - this.sObjectName - } + new List{ className, String.valueOf(triggerOperation), this.sObjectName } ) ); } @@ -575,9 +522,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeInsertActionMetadata { get { if (beforeInsertActionMetadata == null) { - beforeInsertActionMetadata = getActionMetadata( - TriggerOperation.BEFORE_INSERT.name() - ); + beforeInsertActionMetadata = getActionMetadata(TriggerOperation.BEFORE_INSERT.name()); } return beforeInsertActionMetadata; } @@ -593,9 +538,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterInsertActionMetadata { get { if (afterInsertActionMetadata == null) { - afterInsertActionMetadata = getActionMetadata( - TriggerOperation.AFTER_INSERT.name() - ); + afterInsertActionMetadata = getActionMetadata(TriggerOperation.AFTER_INSERT.name()); } return afterInsertActionMetadata; } @@ -611,9 +554,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeUpdateActionMetadata { get { if (beforeUpdateActionMetadata == null) { - beforeUpdateActionMetadata = getActionMetadata( - TriggerOperation.BEFORE_UPDATE.name() - ); + beforeUpdateActionMetadata = getActionMetadata(TriggerOperation.BEFORE_UPDATE.name()); } return beforeUpdateActionMetadata; } @@ -629,9 +570,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterUpdateActionMetadata { get { if (afterUpdateActionMetadata == null) { - afterUpdateActionMetadata = getActionMetadata( - TriggerOperation.AFTER_UPDATE.name() - ); + afterUpdateActionMetadata = getActionMetadata(TriggerOperation.AFTER_UPDATE.name()); } return afterUpdateActionMetadata; } @@ -647,9 +586,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeDeleteActionMetadata { get { if (beforeDeleteActionMetadata == null) { - beforeDeleteActionMetadata = getActionMetadata( - TriggerOperation.BEFORE_DELETE.name() - ); + beforeDeleteActionMetadata = getActionMetadata(TriggerOperation.BEFORE_DELETE.name()); } return beforeDeleteActionMetadata; } @@ -665,9 +602,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterDeleteActionMetadata { get { if (afterDeleteActionMetadata == null) { - afterDeleteActionMetadata = getActionMetadata( - TriggerOperation.AFTER_DELETE.name() - ); + afterDeleteActionMetadata = getActionMetadata(TriggerOperation.AFTER_DELETE.name()); } return afterDeleteActionMetadata; } @@ -683,9 +618,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterUndeleteActionMetadata { get { if (afterUndeleteActionMetadata == null) { - afterUndeleteActionMetadata = getActionMetadata( - TriggerOperation.AFTER_UNDELETE.name() - ); + afterUndeleteActionMetadata = getActionMetadata(TriggerOperation.AFTER_UNDELETE.name()); } return afterUndeleteActionMetadata; } @@ -710,4 +643,4 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private class MetadataTriggerHandlerException extends Exception { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls index 20e394b..4110f09 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls @@ -14,9 +14,7 @@ limitations under the License. */ -@SuppressWarnings( - 'PMD.ApexDoc, PMD.CyclomaticComplexity, PMD.ApexUnitTestClassShouldHaveRunAs' -) +@SuppressWarnings('PMD.ApexDoc, PMD.CyclomaticComplexity, PMD.ApexUnitTestClassShouldHaveRunAs') @IsTest(isParallel=true) private class MetadataTriggerHandlerTest { private static final String ACCOUNT = 'Account'; @@ -51,9 +49,7 @@ private class MetadataTriggerHandlerTest { ); private static sObject_Trigger_Setting__mdt setting = new sObject_Trigger_Setting__mdt( Object_API_Name__c = ACCOUNT, - Id = TriggerTestUtility.getFakeId( - Schema.sObject_Trigger_Setting__mdt.SObjectType - ) + Id = TriggerTestUtility.getFakeId(Schema.sObject_Trigger_Setting__mdt.SObjectType) ); private static MetadataTriggerHandler handler = new MetadataTriggerHandler(); private static Boolean executed = false; @@ -73,9 +69,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldSucceed() { - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; handler.beforeInsert(handler.triggerNew); @@ -85,9 +79,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_AFTER_INSERT; - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; try { handler.beforeInsert(handler.triggerNew); @@ -113,9 +105,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; try { handler.beforeInsert(handler.triggerNew); @@ -203,9 +193,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldSucceed() { action.Apex_Class_Name__c = TEST_BEFORE_UPDATE; - handler.beforeUpdateActionMetadata = new List{ - action - }; + handler.beforeUpdateActionMetadata = new List{ action }; handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -215,9 +203,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.beforeUpdateActionMetadata = new List{ - action - }; + handler.beforeUpdateActionMetadata = new List{ action }; try { handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -243,9 +229,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeUpdateActionMetadata = new List{ - action - }; + handler.beforeUpdateActionMetadata = new List{ action }; try { handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -333,9 +317,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldSucceed() { action.Apex_Class_Name__c = TEST_BEFORE_DELETE; - handler.beforeDeleteActionMetadata = new List{ - action - }; + handler.beforeDeleteActionMetadata = new List{ action }; handler.beforeDelete(handler.triggerOld); @@ -345,9 +327,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.beforeDeleteActionMetadata = new List{ - action - }; + handler.beforeDeleteActionMetadata = new List{ action }; try { handler.beforeDelete(handler.triggerOld); @@ -373,9 +353,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeDeleteActionMetadata = new List{ - action - }; + handler.beforeDeleteActionMetadata = new List{ action }; try { handler.beforeDelete(handler.triggerOld); @@ -463,9 +441,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldSucceed() { action.Apex_Class_Name__c = TEST_AFTER_UNDELETE; - handler.afterUndeleteActionMetadata = new List{ - action - }; + handler.afterUndeleteActionMetadata = new List{ action }; handler.afterUndelete(handler.triggerOld); @@ -475,9 +451,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.afterUndeleteActionMetadata = new List{ - action - }; + handler.afterUndeleteActionMetadata = new List{ action }; try { handler.afterUndelete(handler.triggerOld); @@ -503,9 +477,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.afterUndeleteActionMetadata = new List{ - action - }; + handler.afterUndeleteActionMetadata = new List{ action }; try { handler.afterUndelete(handler.triggerOld); @@ -530,9 +502,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void nothingToProcessShouldExitEarly() { - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; handler.beforeInsert(new List()); @@ -633,9 +603,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldExecuteIfNoRequiredOrBypassPermissionsAreDefinedForSObjectOrAction() { - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); MetadataTriggerHandler.permissionMap.clear(); @@ -648,9 +616,7 @@ private class MetadataTriggerHandlerTest { private static void actionShouldExecuteIfUserDoesNotHaveBypassPermissionForSObjectOrAction() { setting.Bypass_Permission__c = BYPASS_PERMISSION; action.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); MetadataTriggerHandler.permissionMap.clear(); @@ -662,12 +628,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserDoesNotHaveRequiredPermissionForSObject() { setting.Required_Permission__c = REQUIRED_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - REQUIRED_PERMISSION => false - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ REQUIRED_PERMISSION => false }; handler.beforeInsert(handler.triggerNew); @@ -677,12 +639,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserDoesNotHaveRequiredPermissionForAction() { action.Required_Permission__c = REQUIRED_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - REQUIRED_PERMISSION => false - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ REQUIRED_PERMISSION => false }; handler.beforeInsert(handler.triggerNew); @@ -692,12 +650,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserHasBypassPermissionForSObject() { setting.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - BYPASS_PERMISSION => true - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ BYPASS_PERMISSION => true }; handler.beforeInsert(handler.triggerNew); @@ -707,12 +661,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserHasBypassPermissionForAction() { action.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - BYPASS_PERMISSION => true - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ BYPASS_PERMISSION => true }; handler.beforeInsert(handler.triggerNew); @@ -735,9 +685,7 @@ private class MetadataTriggerHandlerTest { action.Allow_Flow_Recursion__c = false; MetadataTriggerHandler.bypass(TriggerActionFlow.class.getName()); - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; try { handler.beforeInsert(handler.triggerNew); @@ -759,18 +707,12 @@ private class MetadataTriggerHandlerTest { } } public class TestBeforeUpdate implements TriggerAction.BeforeUpdate { - public void beforeUpdate( - List triggerNew, - List triggerOld - ) { + public void beforeUpdate(List triggerNew, List triggerOld) { MetadataTriggerHandlerTest.executed = true; } } public class TestAfterUpdate implements TriggerAction.AfterUpdate { - public void afterUpdate( - List triggerNew, - List triggerOld - ) { + public void afterUpdate(List triggerNew, List triggerOld) { MetadataTriggerHandlerTest.executed = true; } } @@ -804,4 +746,4 @@ private class MetadataTriggerHandlerTest { return this.results; } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerAction.cls b/trigger-actions-framework/main/default/classes/TriggerAction.cls index 59f2fea..9144621 100644 --- a/trigger-actions-framework/main/default/classes/TriggerAction.cls +++ b/trigger-actions-framework/main/default/classes/TriggerAction.cls @@ -132,4 +132,4 @@ public class TriggerAction { */ void execute(FinalizerHandler.Context context); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls index accf2a9..eec95aa 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls @@ -31,4 +31,4 @@ public class TriggerActionConstants { TriggerActionConstants.FLOW_STRING, TriggerActionConstants.OBJECT_STRING }; -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls index f4fdfce..1818091 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls @@ -104,9 +104,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE) - ), + invokeAction(getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE)), triggerNew ); } @@ -158,8 +156,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio for (Integer i = 0; i < triggerNew.size(); i++) { sObject record = triggerNew[i]; if ( - TriggerBase.idToNumberOfTimesSeenAfterUpdate.get(record.id) == 1 || - (allowRecursion == true) + TriggerBase.idToNumberOfTimesSeenAfterUpdate.get(record.id) == 1 || (allowRecursion == true) ) { recordsNotYetProcessed.add(record); oldRecordsNotYetProcessed.add(triggerOld[i]); @@ -169,9 +166,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs(recordsNotYetProcessed, oldRecordsNotYetProcessed) - ), + invokeAction(getInterviewInputs(recordsNotYetProcessed, oldRecordsNotYetProcessed)), recordsNotYetProcessed ); } @@ -186,12 +181,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs( - triggerOld, - TriggerActionConstants.RECORD_PRIOR_VARIABLE - ) - ), + invokeAction(getInterviewInputs(triggerOld, TriggerActionConstants.RECORD_PRIOR_VARIABLE)), triggerOld ); } @@ -206,12 +196,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs( - triggerOld, - TriggerActionConstants.RECORD_PRIOR_VARIABLE - ) - ), + invokeAction(getInterviewInputs(triggerOld, TriggerActionConstants.RECORD_PRIOR_VARIABLE)), triggerOld ); } @@ -226,40 +211,27 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE) - ), + invokeAction(getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE)), triggerNew ); } private Boolean flowIsBypassed() { if (String.isBlank(flowName)) { - throw new IllegalArgumentException( - TriggerActionConstants.INVALID_FLOW_NAME - ); + throw new IllegalArgumentException(TriggerActionConstants.INVALID_FLOW_NAME); } return TriggerActionFlow.isBypassed(flowName); } - private List invokeAction( - List> inputs - ) { + private List invokeAction(List> inputs) { return invocableAction.invokeAction(this.flowName, inputs); } - private void applyFlowValues( - sObject stateBeforeFlow, - sObject stateAfterFlow - ) { + private void applyFlowValues(sObject stateBeforeFlow, sObject stateAfterFlow) { Boolean hasBeenMutated = false; Set recordPopulatedFields = new Set(); - recordPopulatedFields.addAll( - stateAfterFlow.getPopulatedFieldsAsMap().keySet() - ); - recordPopulatedFields.addAll( - stateBeforeFlow.getPopulatedFieldsAsMap().keySet() - ); + recordPopulatedFields.addAll(stateAfterFlow.getPopulatedFieldsAsMap().keySet()); + recordPopulatedFields.addAll(stateBeforeFlow.getPopulatedFieldsAsMap().keySet()); for (String fieldName : recordPopulatedFields) { if (stateBeforeFlow.get(fieldName) != stateAfterFlow.get(fieldName)) { stateBeforeFlow.put(fieldName, stateAfterFlow.get(fieldName)); @@ -380,4 +352,4 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return action.invoke(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls index 824e100..ffa9674 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls @@ -55,22 +55,11 @@ public inherited sharing class TriggerActionFlowAddError { * @description This class represents a request to add an error to an sObject. */ public class Request { - @InvocableVariable( - label='Record' - description='Record to add the error to' - required=true - ) + @InvocableVariable(label='Record' description='Record to add the error to' required=true) public SObject record; - @InvocableVariable( - label='Field Name' - description='API name of corresponding field' - ) + @InvocableVariable(label='Field Name' description='API name of corresponding field') public String fieldName; - @InvocableVariable( - label='Error Message' - description='Error Message' - required=true - ) + @InvocableVariable(label='Error Message' description='Error Message' required=true) public String errorMessage; } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls index 870a4f7..2d5938a 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls @@ -31,15 +31,8 @@ private class TriggerActionFlowAddErrorTest { TriggerActionFlowAddError.addError(requests); - System.Assert.isTrue( - account.hasErrors(), - 'The Account should have an error' - ); - System.Assert.areEqual( - 1, - account.getErrors().size(), - 'There should only be one error' - ); + System.Assert.isTrue(account.hasErrors(), 'The Account should have an error'); + System.Assert.areEqual(1, account.getErrors().size(), 'There should only be one error'); System.Assert.areEqual( MY_STRING, account.getErrors()[0].getMessage(), @@ -57,19 +50,12 @@ private class TriggerActionFlowAddErrorTest { TriggerActionFlowAddError.addError(requests); - System.Assert.isTrue( - account.hasErrors(), - 'The Account should have an error' - ); - System.Assert.areEqual( - 1, - account.getErrors().size(), - 'There should only be one error' - ); + System.Assert.isTrue(account.hasErrors(), 'The Account should have an error'); + System.Assert.areEqual(1, account.getErrors().size(), 'There should only be one error'); System.Assert.areEqual( MY_STRING, account.getErrors()[0].getMessage(), 'The error should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls index 239deed..ed1d30c 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls @@ -54,11 +54,7 @@ public inherited sharing class TriggerActionFlowBypass { required=true ) public String name; - @InvocableVariable( - label='Bypass Type' - description='Apex, Flow, or Object' - required=true - ) + @InvocableVariable(label='Bypass Type' description='Apex, Flow, or Object' required=true) public String bypassType; } @@ -75,4 +71,4 @@ public inherited sharing class TriggerActionFlowBypass { TriggerBase.bypass(name); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls index 0c94720..7230976 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls @@ -46,4 +46,4 @@ public inherited sharing abstract class TriggerActionFlowBypassProcessor { protected abstract void processApexBypasses(String requestType); protected abstract void processFlowBypasses(String requestType); protected abstract void processObjectBypasses(String requestType); -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls index 2a7f250..89fa148 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls @@ -30,10 +30,7 @@ private class TriggerActionFlowBypassTest { TriggerActionFlowBypass.bypass(requests); - System.Assert.isTrue( - TriggerBase.isBypassed(MY_STRING), - 'The Object should be bypassed' - ); + System.Assert.isTrue(TriggerBase.isBypassed(MY_STRING), 'The Object should be bypassed'); } @IsTest @@ -58,10 +55,7 @@ private class TriggerActionFlowBypassTest { TriggerActionFlowBypass.bypass(requests); - System.Assert.isTrue( - TriggerActionFlow.isBypassed(MY_STRING), - 'The Flow should be bypassed' - ); + System.Assert.isTrue(TriggerActionFlow.isBypassed(MY_STRING), 'The Flow should be bypassed'); } @IsTest @@ -92,4 +86,4 @@ private class TriggerActionFlowBypassTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls index 45efc9b..2869b6e 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls @@ -66,4 +66,4 @@ public with sharing class TriggerActionFlowChangeEvent extends TriggerActionFlow throw new IllegalArgumentException(NOT_CHANGE_EVENT_ERROR); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls index 4c3068a..b8c5de8 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls @@ -95,4 +95,4 @@ private with sharing class TriggerActionFlowChangeEventTest { 'The value for "header" is constructed improperly' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls index a4aa158..64fe2bf 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls @@ -60,4 +60,4 @@ public inherited sharing class TriggerActionFlowClearAllBypasses { TriggerBase.clearAllBypasses(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls index 503ff66..76300d9 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls @@ -27,10 +27,7 @@ private class TriggerActionFlowClearAllBypassesTest { new List{ TriggerActionConstants.OBJECT_STRING } ); - System.Assert.isFalse( - TriggerBase.isBypassed(MY_STRING), - 'The Object should not be bypassed' - ); + System.Assert.isFalse(TriggerBase.isBypassed(MY_STRING), 'The Object should not be bypassed'); } @IsTest @@ -66,9 +63,7 @@ private class TriggerActionFlowClearAllBypassesTest { Exception myException; try { - TriggerActionFlowClearAllBypasses.clearAllBypasses( - new List{ MY_STRING } - ); + TriggerActionFlowClearAllBypasses.clearAllBypasses(new List{ MY_STRING }); } catch (Exception e) { myException = e; } @@ -89,4 +84,4 @@ private class TriggerActionFlowClearAllBypassesTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls index 6c9dd81..10b596c 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls @@ -27,7 +27,7 @@ * * The `clearBypass` method will clear the bypass for the specified objects, Apex actions, or Flow actions. */ -@SuppressWarnings('PMD.ApexDoc, PMD.CognitiveComplexity') +@SuppressWarnings('PMD.CognitiveComplexity') public inherited sharing class TriggerActionFlowClearBypass { /** * @description This method clears the bypass for the specified objects, Apex actions, or Flow actions. @@ -62,11 +62,7 @@ public inherited sharing class TriggerActionFlowClearBypass { required=true ) public String name; - @InvocableVariable( - label='Bypass Type' - description='Apex, Flow, or Object' - required=true - ) + @InvocableVariable(label='Bypass Type' description='Apex, Flow, or Object' required=true) public String bypassType; } @@ -91,4 +87,4 @@ public inherited sharing class TriggerActionFlowClearBypass { TriggerBase.clearBypass(name); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls index aec67e1..1894cfa 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls @@ -31,10 +31,7 @@ private class TriggerActionFlowClearBypassTest { TriggerActionFlowClearBypass.clearBypass(requests); - System.Assert.isFalse( - TriggerBase.isBypassed(MY_STRING), - 'The Object should not be bypassed' - ); + System.Assert.isFalse(TriggerBase.isBypassed(MY_STRING), 'The Object should not be bypassed'); } @IsTest @@ -95,4 +92,4 @@ private class TriggerActionFlowClearBypassTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls index 1b90586..3d20019 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls @@ -95,4 +95,4 @@ public inherited sharing class TriggerActionFlowIsBypassed { this.hasBeenBypassed = TriggerBase.isBypassed(name); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls index 8a0bd6d..73aedde 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls @@ -30,11 +30,7 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual( - 1, - isBypassed.size(), - 'We should only have one result for our request' - ); + System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); System.Assert.areEqual( TriggerBase.isBypassed(MY_STRING), isBypassed[0], @@ -50,11 +46,7 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual( - 1, - isBypassed.size(), - 'We should only have one result for our request' - ); + System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); System.Assert.areEqual( MetadataTriggerHandler.isBypassed(MY_STRING), isBypassed[0], @@ -70,11 +62,7 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual( - 1, - isBypassed.size(), - 'We should only have one result for our request' - ); + System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); System.Assert.areEqual( TriggerActionFlow.isBypassed(MY_STRING), isBypassed[0], @@ -111,4 +99,4 @@ private class TriggerActionFlowIsBypassedTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls index b9d9a0f..707b4c0 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls @@ -39,10 +39,7 @@ private class TriggerActionFlowTest { Name = MY_ACCOUNT, Id = TriggerTestUtility.getFakeId(Schema.Account.SObjectType) ); - private static Account oldAccount = new Account( - Name = OLD_NAME, - Id = myAccount.Id - ); + private static Account oldAccount = new Account(Name = OLD_NAME, Id = myAccount.Id); private static Account myAccountAfterFlow = myAccount.clone(true); private static List triggerNew = new List{ myAccount }; private static List triggerOld = new List{ oldAccount }; @@ -52,9 +49,7 @@ private class TriggerActionFlowTest { private static Invocable.Action.Result successResult = new InvocableActionResultBuilder() .setSuccess(true) .setOutputParameters( - new Map{ - TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow - } + new Map{ TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow } ) .build(); @@ -135,22 +130,14 @@ private class TriggerActionFlowTest { System.Assert.areEqual(FOO, myAccount.Name, NAME_SET_FROM_FLOW); System.Assert.areEqual(true, myAccount.hasErrors(), ERROR_SHOULD_BE_ADDED); System.Assert.areEqual(1, myAccount.getErrors().size(), ONE_ERROR); - System.Assert.areEqual( - TEST, - myAccount.getErrors()[0].getMessage(), - ERROR_MESSAGE_SHOULD_MATCH - ); + System.Assert.areEqual(TEST, myAccount.getErrors()[0].getMessage(), ERROR_MESSAGE_SHOULD_MATCH); } @IsTest private static void afterInsertShouldSucceed() { actionFlow.afterInsert(triggerNew); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -160,11 +147,7 @@ private class TriggerActionFlowTest { System.Assert.areEqual(FOO, myAccount.Name, NAME_SET_FROM_FLOW); System.Assert.areEqual(true, myAccount.hasErrors(), ERROR_SHOULD_BE_ADDED); System.Assert.areEqual(1, myAccount.getErrors().size(), ONE_ERROR); - System.Assert.areEqual( - TEST, - myAccount.getErrors()[0].getMessage(), - ERROR_MESSAGE_SHOULD_MATCH - ); + System.Assert.areEqual(TEST, myAccount.getErrors()[0].getMessage(), ERROR_MESSAGE_SHOULD_MATCH); } @IsTest @@ -181,11 +164,7 @@ private class TriggerActionFlowTest { private static void afterUpdateShouldSucceed() { actionFlow.afterUpdate(triggerNew, triggerOld); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -195,44 +174,28 @@ private class TriggerActionFlowTest { actionFlow.afterUpdate(triggerNew, triggerOld); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest private static void beforeDeleteShouldSucceed() { actionFlow.beforeDelete(triggerOld); - System.Assert.areEqual( - false, - oldAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, oldAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest private static void afterDeleteShouldSucceed() { actionFlow.afterDelete(triggerOld); - System.Assert.areEqual( - false, - oldAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, oldAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest private static void afterUndeleteShouldSucceed() { actionFlow.afterUndelete(triggerOld); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -249,24 +212,18 @@ private class TriggerActionFlowTest { System.Assert.areEqual( true, - myException.getMessage() - .contains(TriggerActionFlow.RECORD_VARIABLE_NOT_FOUND_ERROR), + myException.getMessage().contains(TriggerActionFlow.RECORD_VARIABLE_NOT_FOUND_ERROR), EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE ); } @IsTest private static void noRecordMutationsShouldSucceed() { - successResult.getOutputParameters() - .put(TriggerActionConstants.RECORD_VARIABLE, myAccount); + successResult.getOutputParameters().put(TriggerActionConstants.RECORD_VARIABLE, myAccount); actionFlow.beforeInsert(triggerNew); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -288,16 +245,11 @@ private class TriggerActionFlowTest { new InvocableActionResultBuilder() .setSuccess(false) .setOutputParameters( - new Map{ - TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow - } + new Map{ TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow } ) .setErrors( new List{ - new InvocableActionErrorBuilder() - .setCode(TEST) - .setMessage(FOO) - .build() + new InvocableActionErrorBuilder().setCode(TEST).setMessage(FOO).build() } ) .build() @@ -362,17 +314,10 @@ private class TriggerActionFlowTest { @IsTest private static void invokeFlowShouldReturnUnsuccessfulResponseWithBogusFlowName() { List results = new TriggerActionFlow.InvocableAction() - .invokeAction( - BOGUS, - new List>{ new Map() } - ); + .invokeAction(BOGUS, new List>{ new Map() }); System.Assert.areEqual(1, results.size(), ONE_ERROR); - System.Assert.areEqual( - false, - results[0].isSuccess(), - 'It should have failed with bogus name' - ); + System.Assert.areEqual(false, results[0].isSuccess(), 'It should have failed with bogus name'); } private virtual class FakeInvocableAction extends TriggerActionFlow.InvocableAction { @@ -394,9 +339,7 @@ private class TriggerActionFlowTest { private Invocable.Action action; private List errors; - public InvocableActionResultBuilder setOutputParameters( - Map outputParameters - ) { + public InvocableActionResultBuilder setOutputParameters(Map outputParameters) { this.outputParameters = outputParameters; return this; } @@ -408,9 +351,7 @@ private class TriggerActionFlowTest { this.action = action; return this; } - public InvocableActionResultBuilder setErrors( - List errors - ) { + public InvocableActionResultBuilder setErrors(List errors) { this.errors = errors; return this; } @@ -447,11 +388,9 @@ private class TriggerActionFlowTest { public Invocable.Action.error build() { return (Invocable.Action.error) JSON.deserialize( - JSON.serialize( - new Map{ 'code' => code, 'message' => message } - ), + JSON.serialize(new Map{ 'code' => code, 'message' => message }), Invocable.Action.error.class ); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerBase.cls b/trigger-actions-framework/main/default/classes/TriggerBase.cls index 61389ec..dd46e62 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBase.cls +++ b/trigger-actions-framework/main/default/classes/TriggerBase.cls @@ -192,15 +192,13 @@ public inherited sharing virtual class TriggerBase { this instanceof TriggerAction.BeforeUpdate ) { this.incrementUpdateCounts(this.context, this.triggerNew); - ((TriggerAction.BeforeUpdate) this) - .beforeUpdate(this.triggerNew, this.triggerOld); + ((TriggerAction.BeforeUpdate) this).beforeUpdate(this.triggerNew, this.triggerOld); } else if ( this.context == System.TriggerOperation.AFTER_UPDATE && this instanceof TriggerAction.AfterUpdate ) { this.incrementUpdateCounts(this.context, this.triggerNew); - ((TriggerAction.AfterUpdate) this) - .afterUpdate(this.triggerNew, this.triggerOld); + ((TriggerAction.AfterUpdate) this).afterUpdate(this.triggerNew, this.triggerOld); } else if ( this.context == System.TriggerOperation.BEFORE_DELETE && this instanceof TriggerAction.BeforeDelete @@ -252,9 +250,7 @@ public inherited sharing virtual class TriggerBase { List records ) { for (SObject obj : records) { - Map idToUpdateCount = CONTEXT_TO_UPDATE_COUNT.get( - triggerContext - ); + Map idToUpdateCount = CONTEXT_TO_UPDATE_COUNT.get(triggerContext); Integer updateCount = idToUpdateCount.get(obj.Id); if (updateCount == null) { updateCount = 0; @@ -313,10 +309,7 @@ public inherited sharing virtual class TriggerBase { protected String sObjectName { get { if (sObjectName == null) { - sObjectName = this.sObjectType.getDescribe( - SObjectDescribeOptions.DEFERRED - ) - .getName(); + sObjectName = this.sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getName(); } return sObjectName; } @@ -358,9 +351,7 @@ public inherited sharing virtual class TriggerBase { private Integer triggerSize { get { - return triggerNew != null - ? triggerNew.size() - : triggerOld != null ? triggerOld.size() : 0; + return triggerNew != null ? triggerNew.size() : triggerOld != null ? triggerOld.size() : 0; } } @@ -428,4 +419,4 @@ public inherited sharing virtual class TriggerBase { @TestVisible private class EmptyStackException extends Exception { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls index 54e65f9..0687010 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls @@ -70,16 +70,8 @@ private class TriggerBaseTest { base.triggerNew = null; base.triggerOld = null; - System.Assert.areEqual( - null, - base.triggerNew, - 'triggerNew should match Trigger.new' - ); - System.Assert.areEqual( - null, - base.triggerOld, - 'triggerOld should match Trigger.old' - ); + System.Assert.areEqual(null, base.triggerNew, 'triggerNew should match Trigger.new'); + System.Assert.areEqual(null, base.triggerOld, 'triggerOld should match Trigger.old'); } @IsTest @@ -182,11 +174,7 @@ private class TriggerBaseTest { myException = e; } - System.Assert.areNotEqual( - null, - myException, - 'An exception should be thrown' - ); + System.Assert.areNotEqual(null, myException, 'An exception should be thrown'); System.Assert.areEqual( TriggerBase.HANDLER_OUTSIDE_TRIGGER_MESSAGE, myException.getMessage(), @@ -276,10 +264,7 @@ private class TriggerBaseTest { private static void isBypassedShouldSucceed() { TriggerBase.bypass(ACCOUNT); - System.Assert.isTrue( - TriggerBase.isBypassed(ACCOUNT), - BYPASSES_SHOULD_BE_CONFIGURED_CORRECTLY - ); + System.Assert.isTrue(TriggerBase.isBypassed(ACCOUNT), BYPASSES_SHOULD_BE_CONFIGURED_CORRECTLY); } @IsTest @@ -299,11 +284,7 @@ private class TriggerBaseTest { private static void offsetRowsShouldWork() { TriggerBase.offsetExistingDmlRows(); - System.Assert.areEqual( - 0, - TriggerBase.existingDmlRowsOffset, - 'Offset is not working properly' - ); + System.Assert.areEqual(0, TriggerBase.existingDmlRowsOffset, 'Offset is not working properly'); } @IsTest @@ -343,10 +324,7 @@ private class TriggerBaseTest { stack.push(FIRST); stack.pop(); - System.Assert.isTrue( - stack.isEmpty(), - 'The stack is empty but unable to identify as such' - ); + System.Assert.isTrue(stack.isEmpty(), 'The stack is empty but unable to identify as such'); } @IsTest @@ -387,11 +365,7 @@ private class TriggerBaseTest { stack.push(SECOND); stack.push(THIRD); - System.Assert.areEqual( - THIRD, - stack.peek(), - 'The last element in the stack is not peeked' - ); + System.Assert.areEqual(THIRD, stack.peek(), 'The last element in the stack is not peeked'); } @IsTest @@ -401,11 +375,7 @@ private class TriggerBaseTest { stack.push(SECOND); stack.push(THIRD); - System.Assert.areEqual( - 3, - stack.depth(), - 'The stack is not properly calculating its depth' - ); + System.Assert.areEqual(3, stack.depth(), 'The stack is not properly calculating its depth'); } @IsTest @@ -452,16 +422,10 @@ private class TriggerBaseTest { public void afterInsert(List triggerNew) { this.executed = true; } - public void beforeUpdate( - List triggerNew, - List triggerOld - ) { + public void beforeUpdate(List triggerNew, List triggerOld) { this.executed = true; } - public void afterUpdate( - List triggerNew, - List triggerOld - ) { + public void afterUpdate(List triggerNew, List triggerOld) { this.executed = true; } public void beforeDelete(List triggerOld) { @@ -484,4 +448,4 @@ private class TriggerBaseTest { return super.getDmlRows(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerRecord.cls b/trigger-actions-framework/main/default/classes/TriggerRecord.cls index fff6e45..5733709 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecord.cls +++ b/trigger-actions-framework/main/default/classes/TriggerRecord.cls @@ -28,4 +28,4 @@ global abstract class TriggerRecord { * @description The previous version of the SObject that triggered the current execution context. */ global SObject oldSobject; -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls index f111235..a8aca7b 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls @@ -34,4 +34,4 @@ private class TriggerRecordTest { private class AccountTriggerRecord extends TriggerRecord { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls index 1353a32..7992d0c 100644 --- a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls +++ b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls @@ -35,9 +35,8 @@ public class TriggerTestUtility { */ public static Id getFakeId(Schema.SObjectType sObjectType) { String result = String.valueOf(myNumber++); - return (Id) (sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED) - .getKeyPrefix() + + return (Id) (sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getKeyPrefix() + '0'.repeat(12 - result.length()) + result); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml index 835ede4..5f399c3 100644 --- a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml b/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml index e87be1f..8d7e554 100644 --- a/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml +++ b/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml @@ -82,9 +82,9 @@ true false - - - + + + false @@ -98,4 +98,4 @@ 0 Default - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml index 54647c1..0486d7d 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -11,4 +11,4 @@ true Text true - \ No newline at end of file + diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml index ee8fe5e..ef423e0 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml @@ -1,4 +1,4 @@ - + Trigger Actions diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml index 68f7025..8dd5f24 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml @@ -1,12 +1,10 @@ - + After_Delete__c - Enter the name of the sObject you want to have this action execute on during the after delete context + Enter the name of the sObject you want to have this action execute on during the after delete context false DeveloperControlled - Enter the name of the sObject you want to have this action execute on during the after delete context + Enter the name of the sObject you want to have this action execute on during the after delete context sObject_Trigger_Setting__mdt After Delete diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml index 302fb0b..67a7d61 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml @@ -1,12 +1,10 @@ - + After_Insert__c - Enter the name of the sObject you want to have this action execute on during the after insert context + Enter the name of the sObject you want to have this action execute on during the after insert context false DeveloperControlled - Enter the name of the sObject you want to have this action execute on during the after insert context + Enter the name of the sObject you want to have this action execute on during the after insert context sObject_Trigger_Setting__mdt After Insert diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml index 3fd9b8b..a7192c3 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml @@ -1,12 +1,10 @@ - + After_Undelete__c - Enter the name of the sObject you want to have this action execute on during the after undelete context + Enter the name of the sObject you want to have this action execute on during the after undelete context false DeveloperControlled - Enter the name of the sObject you want to have this action execute on during the after undelete context + Enter the name of the sObject you want to have this action execute on during the after undelete context sObject_Trigger_Setting__mdt After Undelete diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml index c3b0fe5..5180037 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml @@ -1,12 +1,10 @@ - + After_Update__c - Enter the name of the sObject you want to have this action execute on during the after update context + Enter the name of the sObject you want to have this action execute on during the after update context false DeveloperControlled - Enter the name of the sObject you want to have this action execute on during the after update context + Enter the name of the sObject you want to have this action execute on during the after update context sObject_Trigger_Setting__mdt After Update diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml index c286467..723a7d5 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml @@ -1,13 +1,11 @@ - + Allow_Flow_Recursion__c false - Check this box to allow the flow to execute recursively + Check this box to allow the flow to execute recursively false DeveloperControlled - Check this box to allow the flow to execute recursively + Check this box to allow the flow to execute recursively Checkbox diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml index 90ec74b..43c2083 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -1,12 +1,10 @@ - + Apex_Class_Name__c - Enter the name of the Apex Class which defines the action to be taken + Enter the name of the Apex Class which defines the action to be taken false DeveloperControlled - Enter the name of the Apex Class which defines the action to be taken + Enter the name of the Apex Class which defines the action to be taken 255 true diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml index e65d335..3798ea7 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml @@ -1,12 +1,10 @@ - + Before_Delete__c - Enter the name of the sObject you want to have this action execute on during the before delete context + Enter the name of the sObject you want to have this action execute on during the before delete context false DeveloperControlled - Enter the name of the sObject you want to have this action execute on during the before delete context + Enter the name of the sObject you want to have this action execute on during the before delete context sObject_Trigger_Setting__mdt Before Delete diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml index e1a0925..1b4e15f 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml @@ -1,12 +1,10 @@ - + Before_Insert__c - Enter the name of the sObject you want to have this action execute on during the before insert context + Enter the name of the sObject you want to have this action execute on during the before insert context false DeveloperControlled - Enter the name of the sObject you want to have this action execute on during the before insert context + Enter the name of the sObject you want to have this action execute on during the before insert context sObject_Trigger_Setting__mdt Before Insert diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml index d3ed1f4..32e11fb 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml @@ -1,12 +1,10 @@ - + Before_Update__c - Enter the name of the sObject you want to have this action execute on during the before update context + Enter the name of the sObject you want to have this action execute on during the before update context false DeveloperControlled - Enter the name of the sObject you want to have this action execute on during the before update context + Enter the name of the sObject you want to have this action execute on during the before update context sObject_Trigger_Setting__mdt Before Update diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml index 90bc22f..d2229b9 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -1,13 +1,11 @@ - + Bypass_Execution__c false - Set this to true to bypass this Trigger Action from being called + Set this to true to bypass this Trigger Action from being called false DeveloperControlled - Set this to true to bypass this Trigger Action from being called + Set this to true to bypass this Trigger Action from being called Checkbox diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml index ea16c02..f16b52e 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -1,12 +1,10 @@ - + Bypass_Permission__c - 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. + 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. false DeveloperControlled - 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. + 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. 255 false diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml index fd4a327..2eb9065 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml @@ -1,4 +1,4 @@ - + Description__c false diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml index f5362c6..e543fe3 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml @@ -1,12 +1,10 @@ - + Flow_Name__c - Enter the API name of the flow you would like to execute. + Enter the API name of the flow you would like to execute. false DeveloperControlled - Enter the API name of the flow you would like to execute. + Enter the API name of the flow you would like to execute. 255 false diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml index 428e5f1..77370ed 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml @@ -1,4 +1,4 @@ - + Order__c false diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml index 32ce281..cb1515a 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml @@ -1,12 +1,10 @@ - + Required_Permission__c - 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. + 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. false DeveloperControlled - 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. + 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. 255 false diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml index 1f8bbc0..88dfb3f 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml @@ -1,11 +1,9 @@ - + Description_is_Required true - You must enter a description for this Trigger Action. + You must enter a description for this Trigger Action. ISBLANK(Description__c) Description__c - You must enter a description for this Trigger Action. + You must enter a description for this Trigger Action. diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml index f986af2..99efc72 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml @@ -1,9 +1,8 @@ - + Must_Choose_A_Context false - Throws an error if the user does not choose at least one context + Throws an error if the user does not choose at least one context ISBLANK(Before_Insert__c) && ISBLANK(After_Insert__c) diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml index 98fdf1a..29c5c4a 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml @@ -1,9 +1,8 @@ - + Only_One_Context true - Throws an error if the user selects more than one context. + Throws an error if the user selects more than one context. OR( NOT(ISBLANK(Before_Insert__c)) && OR( diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml index 9180b29..ddfbbae 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml @@ -1,11 +1,8 @@ - + Recursion_Only_For_Flows true - Throws an error if the "Allow Flow Recursion" checkbox is checked without a "Flow Name". - Allow_Flow_Recursion__c == true && ISBLANK( Flow_Name__c ) - You can only mark "Allow Flow Recursion" checkbox as "True" when you have a value for "Flow Name". + Throws an error if the "Allow Flow Recursion" checkbox is checked without a "Flow Name". + Allow_Flow_Recursion__c == true && ISBLANK( Flow_Name__c ) + You can only mark "Allow Flow Recursion" checkbox as "True" when you have a value for "Flow Name". diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml index 9f31adb..2c602b6 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -1,13 +1,11 @@ - + Bypass_Execution__c false - Set this to true to bypass all Trigger Actions from being called on this sObject + Set this to true to bypass all Trigger Actions from being called on this sObject false DeveloperControlled - Set this to true to bypass all Trigger Actions from being called on this sObject + Set this to true to bypass all Trigger Actions from being called on this sObject Checkbox diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml index ea16c02..f16b52e 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -1,12 +1,10 @@ - + Bypass_Permission__c - 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. + 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. false DeveloperControlled - 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. + 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. 255 false diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml index 946b62f..316aea6 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml @@ -1,12 +1,10 @@ - + Object_API_Name__c - Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. + Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. false DeveloperControlled - Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. + Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. 255 true diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml index 9539903..648f0f0 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml @@ -1,11 +1,10 @@ - + Object_Namespace__c Enter the namespace object for this trigger. false DeveloperControlled - Enter the namespace object for this trigger. + Enter the namespace object for this trigger. 255 false diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml index ed1a9c4..14785e9 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml @@ -1,12 +1,10 @@ - + Required_Permission__c - 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. + 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. false DeveloperControlled - 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. + 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. 255 false diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml index 4de350a..fd5ff58 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml @@ -1,4 +1,4 @@ - + sObject Trigger Settings From d5a9c21fa5dfa1a0ed20e7e856731b1dbfe15624 Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Wed, 19 Mar 2025 16:21:15 -0700 Subject: [PATCH 03/16] add list views --- .../listViews/All.listView-meta.xml | 11 +++++++++++ .../listViews/All.listView-meta.xml | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml create mode 100644 trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml new file mode 100644 index 0000000..09d016d --- /dev/null +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml @@ -0,0 +1,11 @@ + + + All + MasterLabel + DeveloperName + Apex_Class_Name__c + Flow_Name__c + Order__c + Everything + + diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml new file mode 100644 index 0000000..987b9ff --- /dev/null +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml @@ -0,0 +1,10 @@ + + + All + MasterLabel + DeveloperName + Object_API_Name__c + Object_Namespace__c + Everything + + From 4bcf28b4e4ca6881d57515b28cfa9314594a22f8 Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Wed, 19 Mar 2025 16:34:28 -0700 Subject: [PATCH 04/16] all fields SubscriberControlled --- .../DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml | 2 +- .../fields/Bypass_Execution__c.field-meta.xml | 2 +- .../fields/Bypass_Permission__c.field-meta.xml | 2 +- .../objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml | 2 +- .../fields/Required_Permission__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/After_Update__c.field-meta.xml | 2 +- .../fields/Allow_Flow_Recursion__c.field-meta.xml | 2 +- .../fields/Apex_Class_Name__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml | 2 +- .../fields/Bypass_Execution__c.field-meta.xml | 2 +- .../fields/Bypass_Permission__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Description__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml | 2 +- .../objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml | 2 +- .../fields/Required_Permission__c.field-meta.xml | 2 +- .../fields/Bypass_Execution__c.field-meta.xml | 2 +- .../fields/Bypass_Permission__c.field-meta.xml | 2 +- .../fields/Object_API_Name__c.field-meta.xml | 2 +- .../fields/Object_Namespace__c.field-meta.xml | 2 +- .../fields/Required_Permission__c.field-meta.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml index 0486d7d..c78a0b1 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -4,7 +4,7 @@ false Enter the name of the Apex Class which defines the action to be taken false - DeveloperControlled + SubscriberControlled Enter the name of the Apex Class which defines the action to be taken 255 diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml index d2229b9..a99bec8 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -4,7 +4,7 @@ false Set this to true to bypass this Trigger Action from being called false - DeveloperControlled + SubscriberControlled Set this to true to bypass this Trigger Action from being called Checkbox diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml index f16b52e..e1299b3 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Bypass_Permission__c 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. false - DeveloperControlled + SubscriberControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml index 77370ed..6d551e7 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml @@ -2,7 +2,7 @@ Order__c false - DeveloperControlled + SubscriberControlled 18 true diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml index cb1515a..4939ecb 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Required_Permission__c 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. false - DeveloperControlled + SubscriberControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml index 8dd5f24..ac2f9f6 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml @@ -3,7 +3,7 @@ After_Delete__c Enter the name of the sObject you want to have this action execute on during the after delete context false - DeveloperControlled + SubscriberControlled Enter the name of the sObject you want to have this action execute on during the after delete context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml index 67a7d61..b508c32 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml @@ -3,7 +3,7 @@ After_Insert__c Enter the name of the sObject you want to have this action execute on during the after insert context false - DeveloperControlled + SubscriberControlled Enter the name of the sObject you want to have this action execute on during the after insert context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml index a7192c3..564833d 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml @@ -3,7 +3,7 @@ After_Undelete__c Enter the name of the sObject you want to have this action execute on during the after undelete context false - DeveloperControlled + SubscriberControlled Enter the name of the sObject you want to have this action execute on during the after undelete context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml index 5180037..6e16982 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml @@ -3,7 +3,7 @@ After_Update__c Enter the name of the sObject you want to have this action execute on during the after update context false - DeveloperControlled + SubscriberControlled Enter the name of the sObject you want to have this action execute on during the after update context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml index 723a7d5..5ec9eea 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml @@ -4,7 +4,7 @@ false Check this box to allow the flow to execute recursively false - DeveloperControlled + SubscriberControlled Check this box to allow the flow to execute recursively Checkbox diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml index 43c2083..9a585d0 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -3,7 +3,7 @@ Apex_Class_Name__c Enter the name of the Apex Class which defines the action to be taken false - DeveloperControlled + SubscriberControlled Enter the name of the Apex Class which defines the action to be taken 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml index 3798ea7..574092a 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml @@ -3,7 +3,7 @@ Before_Delete__c Enter the name of the sObject you want to have this action execute on during the before delete context false - DeveloperControlled + SubscriberControlled Enter the name of the sObject you want to have this action execute on during the before delete context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml index 1b4e15f..46679a0 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml @@ -3,7 +3,7 @@ Before_Insert__c Enter the name of the sObject you want to have this action execute on during the before insert context false - DeveloperControlled + SubscriberControlled Enter the name of the sObject you want to have this action execute on during the before insert context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml index 32e11fb..1d0fdf5 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml @@ -3,7 +3,7 @@ Before_Update__c Enter the name of the sObject you want to have this action execute on during the before update context false - DeveloperControlled + SubscriberControlled Enter the name of the sObject you want to have this action execute on during the before update context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml index d2229b9..a99bec8 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -4,7 +4,7 @@ false Set this to true to bypass this Trigger Action from being called false - DeveloperControlled + SubscriberControlled Set this to true to bypass this Trigger Action from being called Checkbox diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml index f16b52e..e1299b3 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Bypass_Permission__c 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. false - DeveloperControlled + SubscriberControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml index 2eb9065..ea207c0 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml @@ -2,7 +2,7 @@ Description__c false - DeveloperControlled + SubscriberControlled 32768 LongTextArea diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml index e543fe3..2483ab8 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml @@ -3,7 +3,7 @@ Flow_Name__c Enter the API name of the flow you would like to execute. false - DeveloperControlled + SubscriberControlled Enter the API name of the flow you would like to execute. 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml index 77370ed..6d551e7 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml @@ -2,7 +2,7 @@ Order__c false - DeveloperControlled + SubscriberControlled 18 true diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml index cb1515a..4939ecb 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Required_Permission__c 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. false - DeveloperControlled + SubscriberControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml index 2c602b6..dd5d4cf 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -4,7 +4,7 @@ false Set this to true to bypass all Trigger Actions from being called on this sObject false - DeveloperControlled + SubscriberControlled Set this to true to bypass all Trigger Actions from being called on this sObject Checkbox diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml index f16b52e..e1299b3 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Bypass_Permission__c 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. false - DeveloperControlled + SubscriberControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml index 316aea6..865b178 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml @@ -3,7 +3,7 @@ Object_API_Name__c Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. false - DeveloperControlled + SubscriberControlled Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml index 648f0f0..a0f8bdb 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml @@ -3,7 +3,7 @@ Object_Namespace__c Enter the namespace object for this trigger. false - DeveloperControlled + SubscriberControlled Enter the namespace object for this trigger. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml index 14785e9..a103632 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Required_Permission__c 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. false - DeveloperControlled + SubscriberControlled 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. 255 From ffcec92736dda27587b775beaf14e701a7d01d28 Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Wed, 19 Mar 2025 17:13:54 -0700 Subject: [PATCH 05/16] add Bypass Execution to related list --- ...ing__mdt-sObject Trigger Setting Layout.layout-meta.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml b/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml index e38ccd9..d152de8 100644 --- a/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml +++ b/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml @@ -96,6 +96,7 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c + Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.Before_Insert__c @@ -107,6 +108,7 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c + Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Insert__c @@ -118,6 +120,7 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c + Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.Before_Update__c @@ -129,6 +132,7 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c + Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Update__c @@ -140,6 +144,7 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c + Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.Before_Delete__c @@ -151,6 +156,7 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c + Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Delete__c @@ -162,6 +168,7 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c + Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Undelete__c From b95b25350c9078e2a73f5499504831fe53d22471 Mon Sep 17 00:00:00 2001 From: David Schach Date: Wed, 19 Mar 2025 17:28:34 -0700 Subject: [PATCH 06/16] include husky pre-commit --- .husky/_/pre-commit | 1 + package.json | 1 + 2 files changed, 2 insertions(+) create mode 100644 .husky/_/pre-commit diff --git a/.husky/_/pre-commit b/.husky/_/pre-commit new file mode 100644 index 0000000..f27575a --- /dev/null +++ b/.husky/_/pre-commit @@ -0,0 +1 @@ +npm run precommit diff --git a/package.json b/package.json index 61617d0..01bea72 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "version": "1.0.0", "description": "Apex Trigger Actions Framework", "scripts": { + "precommit": "lint-staged", "prepare": "husky", "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"" From e275ee99ad761136d3992a9850f13ee39aaa7597 Mon Sep 17 00:00:00 2001 From: David Schach Date: Thu, 20 Mar 2025 14:29:27 -0700 Subject: [PATCH 07/16] Revert "run prettier" This reverts commit c1d8970e8d88bb38207d7e340798fc3c5366ad22. --- .github/workflows/CI.yml | 4 +- .github/workflows/Package.yml | 2 +- .prettierrc | 72 +--- config/project-scratch-def.json | 6 +- docs/custom-objects/DML_Finalizer__mdt.md | 20 +- docs/custom-objects/Trigger_Action__mdt.md | 53 +-- .../sObject_Trigger_Setting__mdt.md | 24 +- docs/index.md | 377 +++++++++--------- .../FinalizerHandler.md | 94 ++--- .../FlowChangeEventHeader.md | 50 +-- .../MetadataTriggerHandler.md | 225 ++++------- .../TriggerAction.md | 99 ++--- .../TriggerActionConstants.md | 19 +- .../TriggerActionFlow.md | 103 ++--- .../TriggerActionFlowAddError.md | 40 +- .../TriggerActionFlowBypass.md | 28 +- .../TriggerActionFlowBypassProcessor.md | 25 +- .../TriggerActionFlowChangeEvent.md | 136 +++---- .../TriggerActionFlowClearAllBypasses.md | 28 +- .../TriggerActionFlowClearBypass.md | 46 +-- .../TriggerActionFlowIsBypassed.md | 54 +-- docs/trigger-actions-framework/TriggerBase.md | 74 ++-- .../TriggerTestUtility.md | 20 +- package.json | 64 +-- sfdx-project.json | 94 ++--- .../main/default/classes/FinalizerHandler.cls | 24 +- .../classes/FinalizerHandler.cls-meta.xml | 2 +- .../default/classes/FinalizerHandlerTest.cls | 22 +- .../classes/FinalizerHandlerTest.cls-meta.xml | 2 +- .../default/classes/FlowChangeEventHeader.cls | 2 +- .../FlowChangeEventHeader.cls-meta.xml | 2 +- .../classes/FlowChangeEventHeaderTest.cls | 11 +- .../FlowChangeEventHeaderTest.cls-meta.xml | 2 +- .../main/default/classes/FormulaFilter.cls | 33 +- .../classes/FormulaFilter.cls-meta.xml | 2 +- .../default/classes/FormulaFilterTest.cls | 92 ++++- .../classes/FormulaFilterTest.cls-meta.xml | 2 +- .../classes/MetadataTriggerHandler.cls | 131 ++++-- .../MetadataTriggerHandler.cls-meta.xml | 2 +- .../classes/MetadataTriggerHandlerTest.cls | 116 ++++-- .../MetadataTriggerHandlerTest.cls-meta.xml | 2 +- .../main/default/classes/TriggerAction.cls | 2 +- .../classes/TriggerAction.cls-meta.xml | 2 +- .../classes/TriggerActionConstants.cls | 2 +- .../TriggerActionConstants.cls-meta.xml | 2 +- .../default/classes/TriggerActionFlow.cls | 52 ++- .../classes/TriggerActionFlow.cls-meta.xml | 2 +- .../classes/TriggerActionFlowAddError.cls | 19 +- .../TriggerActionFlowAddError.cls-meta.xml | 2 +- .../classes/TriggerActionFlowAddErrorTest.cls | 24 +- ...TriggerActionFlowAddErrorTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowBypass.cls | 8 +- .../TriggerActionFlowBypass.cls-meta.xml | 2 +- .../TriggerActionFlowBypassProcessor.cls | 2 +- ...ggerActionFlowBypassProcessor.cls-meta.xml | 2 +- .../classes/TriggerActionFlowBypassTest.cls | 12 +- .../TriggerActionFlowBypassTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowChangeEvent.cls | 2 +- .../TriggerActionFlowChangeEvent.cls-meta.xml | 2 +- .../TriggerActionFlowChangeEventTest.cls | 2 +- ...ggerActionFlowChangeEventTest.cls-meta.xml | 2 +- .../TriggerActionFlowClearAllBypasses.cls | 2 +- ...gerActionFlowClearAllBypasses.cls-meta.xml | 2 +- .../TriggerActionFlowClearAllBypassesTest.cls | 11 +- ...ctionFlowClearAllBypassesTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowClearBypass.cls | 10 +- .../TriggerActionFlowClearBypass.cls-meta.xml | 2 +- .../TriggerActionFlowClearBypassTest.cls | 7 +- ...ggerActionFlowClearBypassTest.cls-meta.xml | 2 +- .../classes/TriggerActionFlowIsBypassed.cls | 2 +- .../TriggerActionFlowIsBypassed.cls-meta.xml | 2 +- .../TriggerActionFlowIsBypassedTest.cls | 20 +- ...iggerActionFlowIsBypassedTest.cls-meta.xml | 2 +- .../default/classes/TriggerActionFlowTest.cls | 103 ++++- .../TriggerActionFlowTest.cls-meta.xml | 2 +- .../main/default/classes/TriggerBase.cls | 21 +- .../default/classes/TriggerBase.cls-meta.xml | 2 +- .../main/default/classes/TriggerBaseTest.cls | 58 ++- .../classes/TriggerBaseTest.cls-meta.xml | 2 +- .../main/default/classes/TriggerRecord.cls | 2 +- .../classes/TriggerRecord.cls-meta.xml | 2 +- .../default/classes/TriggerRecordTest.cls | 2 +- .../classes/TriggerRecordTest.cls-meta.xml | 2 +- .../default/classes/TriggerTestUtility.cls | 5 +- .../classes/TriggerTestUtility.cls-meta.xml | 2 +- ...__mdt-DML Finalizer Layout.layout-meta.xml | 8 +- .../fields/Apex_Class_Name__c.field-meta.xml | 2 +- .../Trigger_Action__mdt.object-meta.xml | 2 +- .../fields/After_Delete__c.field-meta.xml | 5 +- .../fields/After_Insert__c.field-meta.xml | 7 +- .../fields/After_Undelete__c.field-meta.xml | 5 +- .../fields/After_Update__c.field-meta.xml | 5 +- .../Allow_Flow_Recursion__c.field-meta.xml | 5 +- .../fields/Apex_Class_Name__c.field-meta.xml | 5 +- .../fields/Before_Delete__c.field-meta.xml | 5 +- .../fields/Before_Insert__c.field-meta.xml | 5 +- .../fields/Before_Update__c.field-meta.xml | 5 +- .../fields/Bypass_Execution__c.field-meta.xml | 5 +- .../Bypass_Permission__c.field-meta.xml | 5 +- .../fields/Description__c.field-meta.xml | 2 +- .../fields/Flow_Name__c.field-meta.xml | 5 +- .../fields/Order__c.field-meta.xml | 2 +- .../Required_Permission__c.field-meta.xml | 5 +- ...iption_is_Required.validationRule-meta.xml | 8 +- ...t_Choose_A_Context.validationRule-meta.xml | 5 +- .../Only_One_Context.validationRule-meta.xml | 5 +- ...ion_Only_For_Flows.validationRule-meta.xml | 11 +- .../fields/Bypass_Execution__c.field-meta.xml | 5 +- .../Bypass_Permission__c.field-meta.xml | 5 +- .../fields/Object_API_Name__c.field-meta.xml | 5 +- .../fields/Object_Namespace__c.field-meta.xml | 2 +- .../Required_Permission__c.field-meta.xml | 5 +- ...bject_Trigger_Setting__mdt.object-meta.xml | 2 +- 113 files changed, 1381 insertions(+), 1371 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8444770..4758921 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,10 +16,10 @@ jobs: ref: ${{ github.ref }} fetch-depth: 0 - - name: 'Setup node' + - name: "Setup node" uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: "lts/*" #cache: "npm" - name: Install Salesforce CLI + Scanner diff --git a/.github/workflows/Package.yml b/.github/workflows/Package.yml index b1a612e..98da286 100644 --- a/.github/workflows/Package.yml +++ b/.github/workflows/Package.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: 'lts/*' + node-version: ">=20" - name: Install sf cli run: | diff --git a/.prettierrc b/.prettierrc index 08737ee..50f14e3 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,81 +1,15 @@ { - "arrowParens": "avoid", - "bracketSpacing": true, - "bracketSameLine": true, - "printWidth": 100, - "semi": true, - "singleQuote": true, + "plugins": ["prettier-plugin-apex"], "trailingComma": "none", - "endOfLine": "lf", - "apexInsertFinalNewline": false, "useTabs": true, "overrides": [ { "files": "**/lwc/**/*.html", "options": { "parser": "lwc" } }, - { - "files": "*.{cls,trigger}", - "options": { "parser": "apex", "tabWidth": 2, "useTabs": true } - }, - { - "files": "*.trigger", - "options": { "printWidth": 200 } - }, { "files": "*.{cmp,page,component}", - "options": { - "parser": "html", - "useTabs": true, - "htmlWhitespaceSensitivity": "css" - } - }, - { - "files": "*.{apex,soql}", - "options": { "parser": "apex-anonymous" } - }, - { - "files": "*.{yml,yaml}", - "options": { "parser": "yaml", "tabWidth": 2, "useTabs": false } - }, - { - "files": ".prettier*", - "options": { "parser": "json", "printWidth": 80, "useTabs": true } - }, - { - "files": "*.xml", - "options": { - "parser": "xml", - "useTabs": true, - "singleQuote": false, - "xmlSelfClosingSpace": true - } - }, - { - "files": ["**/pmd/*.xml", "*ruleset*.xml", "config/**/*.xml"], - "options": { - "parser": "xml", - "xmlSelfClosingSpace": true, - "xmlWhitespaceSensitivity": "ignore" - } - }, - { - "files": "*meta.xml", - "options": { - "parser": "xml", - "useTabs": false, - "xmlSelfClosingSpace": false - } - }, - { - "files": "*.json", - "options": { - "parser": "json-stringify", - "useTabs": false, - "tabWidth": 2 - } + "options": { "parser": "html" } } - ], - "plugins": ["prettier-plugin-apex", "@prettier/plugin-xml"], - "$schema": "https://json.schemastore.org/prettierrc" + ] } diff --git a/config/project-scratch-def.json b/config/project-scratch-def.json index 8645f62..796801d 100644 --- a/config/project-scratch-def.json +++ b/config/project-scratch-def.json @@ -1,5 +1,5 @@ { - "orgName": "Demo company", - "edition": "Developer", - "features": [] + "orgName": "Demo company", + "edition": "Developer", + "features": [] } diff --git a/docs/custom-objects/DML_Finalizer__mdt.md b/docs/custom-objects/DML_Finalizer__mdt.md index 6bd61fe..0643cca 100644 --- a/docs/custom-objects/DML_Finalizer__mdt.md +++ b/docs/custom-objects/DML_Finalizer__mdt.md @@ -1,13 +1,10 @@ # 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 @@ -18,10 +15,9 @@ Enter the name of the Apex Class which defines the action to be taken **Type** -_Text_ +*Text* --- - ### Bypass Execution Set this to true to bypass this Trigger Action from being called @@ -32,10 +28,9 @@ Set this to true to bypass this Trigger Action from being called **Type** -_Checkbox_ +*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. @@ -46,12 +41,10 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -_Text_ +*Text* --- - ### Order - **Required** **API Name** @@ -60,13 +53,12 @@ _Text_ **Type** -_Number_ +*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. +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** @@ -74,4 +66,4 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -_Text_ +*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 index e527f90..b57bca8 100644 --- a/docs/custom-objects/Trigger_Action__mdt.md +++ b/docs/custom-objects/Trigger_Action__mdt.md @@ -1,11 +1,9 @@ # 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 @@ -16,10 +14,9 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -_MetadataRelationship_ +*MetadataRelationship* --- - ### After Insert Enter the name of the sObject you want to have this action execute on during the after insert context @@ -30,10 +27,9 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -_MetadataRelationship_ +*MetadataRelationship* --- - ### After Undelete Enter the name of the sObject you want to have this action execute on during the after undelete context @@ -44,10 +40,9 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -_MetadataRelationship_ +*MetadataRelationship* --- - ### After Update Enter the name of the sObject you want to have this action execute on during the after update context @@ -58,10 +53,9 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -_MetadataRelationship_ +*MetadataRelationship* --- - ### Allow Flow Recursion? Check this box to allow the flow to execute recursively @@ -72,12 +66,10 @@ Check this box to allow the flow to execute recursively **Type** -_Checkbox_ +*Checkbox* --- - ### Apex Class Name - **Required** Enter the name of the Apex Class which defines the action to be taken @@ -88,10 +80,9 @@ Enter the name of the Apex Class which defines the action to be taken **Type** -_Text_ +*Text* --- - ### Before Delete Enter the name of the sObject you want to have this action execute on during the before delete context @@ -102,10 +93,9 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -_MetadataRelationship_ +*MetadataRelationship* --- - ### Before Insert Enter the name of the sObject you want to have this action execute on during the before insert context @@ -116,10 +106,9 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -_MetadataRelationship_ +*MetadataRelationship* --- - ### Before Update Enter the name of the sObject you want to have this action execute on during the before update context @@ -130,10 +119,9 @@ Enter the name of the sObject you want to have this action execute on during the **Type** -_MetadataRelationship_ +*MetadataRelationship* --- - ### Bypass Execution Set this to true to bypass this Trigger Action from being called @@ -144,10 +132,9 @@ Set this to true to bypass this Trigger Action from being called **Type** -_Checkbox_ +*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. @@ -158,10 +145,9 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -_Text_ +*Text* --- - ### Description **API Name** @@ -170,10 +156,9 @@ _Text_ **Type** -_LongTextArea_ +*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. @@ -184,10 +169,9 @@ Formula which if evaluated to true for a given record during trigger processing, **Type** -_LongTextArea_ +*LongTextArea* --- - ### Flow Name Enter the API name of the flow you would like to execute. @@ -198,12 +182,10 @@ Enter the API name of the flow you would like to execute. **Type** -_Text_ +*Text* --- - ### Order - **Required** **API Name** @@ -212,13 +194,12 @@ _Text_ **Type** -_Number_ +*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. +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** @@ -226,4 +207,4 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -_Text_ +*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 index 193d55a..5e8d402 100644 --- a/docs/custom-objects/sObject_Trigger_Setting__mdt.md +++ b/docs/custom-objects/sObject_Trigger_Setting__mdt.md @@ -1,11 +1,9 @@ # 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 @@ -16,10 +14,9 @@ Set this to true to bypass all Trigger Actions from being called on this sObject **Type** -_Checkbox_ +*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. @@ -30,12 +27,10 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -_Text_ +*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. @@ -46,10 +41,9 @@ Enter the API Name of the object for this trigger. If this object is part of a m **Type** -_Text_ +*Text* --- - ### Object Namespace Enter the namespace object for this trigger. @@ -60,10 +54,9 @@ Enter the namespace object for this trigger. **Type** -_Text_ +*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. @@ -74,15 +67,14 @@ Optional. Enter the API name of a permission. If this field has a value, then th **Type** -_Text_ +*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. + and `recordPrior`. Both of these variables need to match the SObject type for this SObject + Trigger Setting record. **API Name** @@ -90,4 +82,4 @@ Trigger Setting record. **Type** -_Text_ +*Text* \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 7469a9d..7e0dc28 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,137 +2,128 @@ ## Custom Objects -### [DML_Finalizer\_\_mdt](custom-objects/DML_Finalizer__mdt.md) +### [DML_Finalizer__mdt](custom-objects/DML_Finalizer__mdt.md) -### [Trigger_Action\_\_mdt](custom-objects/Trigger_Action__mdt.md) +### [Trigger_Action__mdt](custom-objects/Trigger_Action__mdt.md) -### [sObject_Trigger_Setting\_\_mdt](custom-objects/sObject_Trigger_Setting__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 `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-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:** - +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 +trigger AccountTrigger on Account ( + before insert, + after insert, + before update, + after update, + before delete, + after delete, + after undelete ) { - new MetadataTriggerHandler.run(); + new MetadataTriggerHandler.run(); } ``` + 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. - ---- - +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) @@ -141,126 +132,124 @@ 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 +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. - ---- - +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. +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 +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 +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 `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 `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 +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 `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. +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 index 0b6a23a..e3d5fb7 100644 --- a/docs/trigger-actions-framework/FinalizerHandler.md +++ b/docs/trigger-actions-framework/FinalizerHandler.md @@ -1,64 +1,55 @@ # 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 `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 | -| --------- | ------ | ------------------------------------ | +| Name | Type | Description | +|------|------|-------------| | finalizer | String | The name of the finalizer to bypass. | #### Return Type - **void** --- @@ -68,19 +59,16 @@ public static void bypass(String finalizer) Clear the bypass for a specific finalizer. #### Signature - ```apex public static void clearBypass(String finalizer) ``` #### Parameters - -| Name | Type | Description | -| --------- | ------ | -------------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | finalizer | String | The name of the finalizer to clear the bypass for. | #### Return Type - **void** --- @@ -90,19 +78,16 @@ public static void clearBypass(String finalizer) Check if a specific finalizer is bypassed. #### Signature - ```apex public static Boolean isBypassed(String finalizer) ``` #### Parameters - -| Name | Type | Description | -| --------- | ------ | ----------------------------------- | +| Name | Type | Description | +|------|------|-------------| | finalizer | String | The name of the finalizer to check. | #### Return Type - **Boolean** True if the finalizer is bypassed, false otherwise. @@ -114,13 +99,11 @@ True if the finalizer is bypassed, false otherwise. Clear all bypasses. #### Signature - ```apex public static void clearAllBypasses() ``` #### Return Type - **void** --- @@ -130,18 +113,15 @@ public static void clearAllBypasses() Handle dynamic finalizers. Instantiates 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. +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 index 8b4a319..0529726 100644 --- a/docs/trigger-actions-framework/FlowChangeEventHeader.md +++ b/docs/trigger-actions-framework/FlowChangeEventHeader.md @@ -1,6 +1,6 @@ # FlowChangeEventHeader Class -A flow-accessible version of the ChangeEventHeader class for use in +A flow-accessible version of the ChangeEventHeader class for use in a flow handler of a change data capture event. **Group** Trigger Actions Framework @@ -8,20 +8,17 @@ a flow handler of a change data capture event. **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 --- @@ -32,13 +29,11 @@ String `AURAENABLED` #### Signature - ```apex public recordIds ``` #### Type - List<String> --- @@ -49,13 +44,11 @@ List<String> `AURAENABLED` #### Signature - ```apex public changeType ``` #### Type - String --- @@ -66,13 +59,11 @@ String `AURAENABLED` #### Signature - ```apex public changeOrigin ``` #### Type - String --- @@ -83,13 +74,11 @@ String `AURAENABLED` #### Signature - ```apex public transactionKey ``` #### Type - String --- @@ -100,13 +89,11 @@ String `AURAENABLED` #### Signature - ```apex public sequenceNumber ``` #### Type - Integer --- @@ -117,13 +104,11 @@ Integer `AURAENABLED` #### Signature - ```apex public commitTimestamp ``` #### Type - Long --- @@ -134,13 +119,11 @@ Long `AURAENABLED` #### Signature - ```apex public commitUser ``` #### Type - String --- @@ -151,13 +134,11 @@ String `AURAENABLED` #### Signature - ```apex public commitNumber ``` #### Type - Long --- @@ -168,13 +149,11 @@ Long `AURAENABLED` #### Signature - ```apex public nulledFields ``` #### Type - List<String> --- @@ -185,13 +164,11 @@ List<String> `AURAENABLED` #### Signature - ```apex public diffFields ``` #### Type - List<String> --- @@ -202,54 +179,45 @@ List<String> `AURAENABLED` #### Signature - ```apex public changedFields ``` #### Type - List<String> ## Constructors - ### `FlowChangeEventHeader(header)` -Constructor that takes an `EventBus.ChangeEventHeader` object and populates +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 | -| ------ | -------------------------- | ---------------------------------------------------------------------------- | +| 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. | +| 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. @@ -261,13 +229,11 @@ public Boolean equals(Object obj) 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. +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 index 175017b..64b5bb3 100644 --- a/docs/trigger-actions-framework/MetadataTriggerHandler.md +++ b/docs/trigger-actions-framework/MetadataTriggerHandler.md @@ -2,65 +2,62 @@ `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:** - +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 +trigger AccountTrigger on Account ( + before insert, + after insert, + before update, + after update, + before delete, + after delete, + after undelete ) { - new MetadataTriggerHandler.run(); + new MetadataTriggerHandler.run(); } ``` + This example will execute all Trigger Actions defined in Custom Metadata for the `Account` sObject. **Group** Trigger Actions Framework @@ -71,72 +68,63 @@ This example will execute all Trigger Actions defined in Custom Metadata for the **Implements** -TriggerAction.BeforeInsert, -TriggerAction.AfterInsert, -TriggerAction.BeforeUpdate, -TriggerAction.AfterUpdate, -TriggerAction.BeforeDelete, -TriggerAction.AfterDelete, +TriggerAction.BeforeInsert, +TriggerAction.AfterInsert, +TriggerAction.BeforeUpdate, +TriggerAction.AfterUpdate, +TriggerAction.BeforeDelete, +TriggerAction.AfterDelete, TriggerAction.AfterUndelete ## Properties - ### `idToNumberOfTimesSeenBeforeUpdate` -_Inherited_ +*Inherited* -This method returns a map of the IDs of the records that have been seen in the `BEFORE_UPDATE` +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_ +*Inherited* -This method returns a map of the IDs of the records that have been seen +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 | -| ---------- | ------ | ----------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | actionName | String | The name of the Trigger Action to bypass. | #### Return Type - **void** --- @@ -146,19 +134,16 @@ public static void bypass(String actionName) Clear the bypass for a Trigger Action. #### Signature - ```apex public static void clearBypass(String actionName) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------ | ------------------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | actionName | String | The name of the Trigger Action to clear the bypass for. | #### Return Type - **void** --- @@ -168,19 +153,16 @@ public static void clearBypass(String actionName) Check if a Trigger Action is bypassed. #### Signature - ```apex public static Boolean isBypassed(String actionName) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------ | ---------------------------------------- | +| 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. @@ -192,13 +174,11 @@ True if the Trigger Action is bypassed, false otherwise. Clear all bypasses for Trigger Actions. #### Signature - ```apex public static void clearAllBypasses() ``` #### Return Type - **void** --- @@ -208,19 +188,16 @@ public static void clearAllBypasses() Execute the Before Insert Trigger Actions. #### Signature - ```apex public void beforeInsert(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | --------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records being inserted. | #### Return Type - **void** --- @@ -230,19 +207,16 @@ public void beforeInsert(List triggerNew) Execute the After Insert Trigger Actions. #### Signature - ```apex public void afterInsert(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that were inserted. | #### Return Type - **void** --- @@ -252,20 +226,17 @@ public void afterInsert(List triggerNew) Execute the Before Update Trigger Actions. #### Signature - ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ------------------------------------------ | -| triggerNew | List<SObject> | The list of updated records. | +| Name | Type | Description | +|------|------|-------------| +| triggerNew | List<SObject> | The list of updated records. | | triggerOld | List<SObject> | The list of old records before the update. | #### Return Type - **void** --- @@ -275,20 +246,17 @@ public void beforeUpdate(List triggerNew, List triggerOld) Execute the After Update Trigger Actions. #### Signature - ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ------------------------------------------ | -| triggerNew | List<SObject> | The list of updated records. | +| Name | Type | Description | +|------|------|-------------| +| triggerNew | List<SObject> | The list of updated records. | | triggerOld | List<SObject> | The list of old records before the update. | #### Return Type - **void** --- @@ -298,19 +266,16 @@ public void afterUpdate(List triggerNew, List triggerOld) Execute the Before Delete Trigger Actions. #### Signature - ```apex public void beforeDelete(List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ---------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of records being deleted. | #### Return Type - **void** --- @@ -320,19 +285,16 @@ public void beforeDelete(List triggerOld) Execute the After Delete Trigger Actions. #### Signature - ```apex public void afterDelete(List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of records that were deleted. | #### Return Type - **void** --- @@ -342,89 +304,78 @@ public void afterDelete(List triggerOld) Execute the After Undelete Trigger Actions. #### Signature - ```apex public void afterUndelete(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ---------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of records that were undeleted. | #### Return Type - **void** --- ### `offsetExistingDmlRows()` -_Inherited_ +*Inherited* This method offsets the number of existing DML rows. #### Signature - ```apex public static void offsetExistingDmlRows() ``` #### Return Type - **void** --- ### `waitToFinalize()` -_Inherited_ +*Inherited* This method waits to finalize the DML operation. #### Signature - ```apex public static void waitToFinalize() ``` #### Return Type - **void** --- ### `nowFinalize()` -_Inherited_ +*Inherited* This method now finalizes the DML operation. #### Signature - ```apex public static void nowFinalize() ``` #### Return Type - **void** --- ### `run()` -_Inherited_ +*Inherited* This method runs the trigger handler. #### Signature - ```apex public void run() ``` #### Return Type - -**void** +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerAction.md b/docs/trigger-actions-framework/TriggerAction.md index 7abee67..412730a 100644 --- a/docs/trigger-actions-framework/TriggerAction.md +++ b/docs/trigger-actions-framework/TriggerAction.md @@ -2,53 +2,46 @@ `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. - ---- - +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 +This interface defines the logic that should be executed before a new record is inserted. #### Methods - ##### `beforeInsert(triggerNew)` This method is called before a new record is inserted. ###### Signature - ```apex public void beforeInsert(List triggerNew) ``` ###### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ------------------------------------------------ | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that are being inserted. | ###### Return Type - **void** ### AfterInsert Interface @@ -56,25 +49,21 @@ public void beforeInsert(List triggerNew) This interface defines the logic that should be executed after a new record is inserted. #### Methods - ##### `afterInsert(triggerNew)` This method is called after a new record is inserted. ###### Signature - ```apex public void afterInsert(List triggerNew) ``` ###### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that were inserted. | ###### Return Type - **void** ### BeforeUpdate Interface @@ -82,26 +71,22 @@ public void afterInsert(List triggerNew) This interface defines the logic that should be executed before a record is updated. #### Methods - ##### `beforeUpdate(triggerNew, triggerOld)` This method is called before a record is updated. ###### Signature - ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` ###### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | ###### Return Type - **void** ### AfterUpdate Interface @@ -109,26 +94,22 @@ public void beforeUpdate(List triggerNew, List triggerOld) This interface defines the logic that should be executed after a record is updated. #### Methods - ##### `afterUpdate(triggerNew, triggerOld)` This method is called after a record is updated. ###### Signature - ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` ###### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ------------------------------------------ | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that were updated. | | triggerOld | List<SObject> | The list of old records that were updated. | ###### Return Type - **void** ### BeforeDelete Interface @@ -136,25 +117,21 @@ public void afterUpdate(List triggerNew, List triggerOld) This interface defines the logic that should be executed before a record is deleted. #### Methods - ##### `beforeDelete(triggerOld)` This method is called before a record is deleted. ###### Signature - ```apex public void beforeDelete(List triggerOld) ``` ###### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of old records that are being deleted. | ###### Return Type - **void** ### AfterDelete Interface @@ -162,25 +139,21 @@ public void beforeDelete(List triggerOld) This interface defines the logic that should be executed after a record is deleted. #### Methods - ##### `afterDelete(triggerOld)` This method is called after a record is deleted. ###### Signature - ```apex public void afterDelete(List triggerOld) ``` ###### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ------------------------------------------ | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of old records that were deleted. | ###### Return Type - **void** ### AfterUndelete Interface @@ -188,25 +161,21 @@ public void afterDelete(List triggerOld) This interface defines the logic that should be executed after a record is undeleted. #### Methods - ##### `afterUndelete(triggerNew)` This method is called after a record is undeleted. ###### Signature - ```apex public void afterUndelete(List triggerNew) ``` ###### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that were undeleted. | ###### Return Type - **void** ### DmlFinalizer Interface @@ -214,23 +183,19 @@ public void afterUndelete(List triggerNew) 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 | -| ------- | ------------------------ | ----------------------------- | +| Name | Type | Description | +|------|------|-------------| | context | FinalizerHandler.Context | The context of the finalizer. | ###### Return Type - -**void** +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionConstants.md b/docs/trigger-actions-framework/TriggerActionConstants.md index 180608c..c151632 100644 --- a/docs/trigger-actions-framework/TriggerActionConstants.md +++ b/docs/trigger-actions-framework/TriggerActionConstants.md @@ -5,17 +5,14 @@ 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 --- @@ -23,13 +20,11 @@ String ### `FLOW_STRING` #### Signature - ```apex public static final FLOW_STRING ``` #### Type - String --- @@ -37,13 +32,11 @@ String ### `OBJECT_STRING` #### Signature - ```apex public static final OBJECT_STRING ``` #### Type - String --- @@ -51,13 +44,11 @@ String ### `RECORD_PRIOR_VARIABLE` #### Signature - ```apex public static final RECORD_PRIOR_VARIABLE ``` #### Type - String --- @@ -65,13 +56,11 @@ String ### `RECORD_VARIABLE` #### Signature - ```apex public static final RECORD_VARIABLE ``` #### Type - String --- @@ -79,13 +68,11 @@ String ### `INVALID_FLOW_NAME` #### Signature - ```apex public static final INVALID_FLOW_NAME ``` #### Type - String --- @@ -93,13 +80,11 @@ String ### `INVALID_TYPE` #### Signature - ```apex public static final INVALID_TYPE ``` #### Type - String --- @@ -107,11 +92,9 @@ String ### `REQUEST_TYPES` #### Signature - ```apex public static final REQUEST_TYPES ``` #### Type - -Set<String> +Set<String> \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlow.md b/docs/trigger-actions-framework/TriggerActionFlow.md index c857661..cc43fbf 100644 --- a/docs/trigger-actions-framework/TriggerActionFlow.md +++ b/docs/trigger-actions-framework/TriggerActionFlow.md @@ -1,36 +1,32 @@ # TriggerActionFlow Class - `virtual` `SUPPRESSWARNINGS` -This class implements the TriggerAction interface and provides a framework for +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.BeforeInsert, +TriggerAction.AfterInsert, +TriggerAction.BeforeUpdate, +TriggerAction.AfterUpdate, +TriggerAction.BeforeDelete, +TriggerAction.AfterDelete, TriggerAction.AfterUndelete ## Fields - ### `flowName` #### Signature - ```apex public flowName ``` #### Type - String --- @@ -38,35 +34,29 @@ 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 | -| -------- | ------ | ----------------------------------- | +| Name | Type | Description | +|------|------|-------------| | flowName | String | The API name of the Flow to bypass. | #### Return Type - **void** --- @@ -76,19 +66,16 @@ public static void bypass(String flowName) This method clears the bypass for the specified list of records. #### Signature - ```apex public static void clearBypass(String flowName) ``` #### Parameters - -| Name | Type | Description | -| -------- | ------ | ------------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | flowName | String | The API name of the Flow to clear the bypass for. | #### Return Type - **void** --- @@ -98,19 +85,16 @@ public static void clearBypass(String 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 | -| -------- | ------ | ------------------------------------------------- | +| 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. @@ -122,13 +106,11 @@ public static Boolean isBypassed(String flowName) This method clears all bypasses for all Flows. #### Signature - ```apex public static void clearAllBypasses() ``` #### Return Type - **void** --- @@ -138,23 +120,19 @@ public static void clearAllBypasses() This method validates the specified bypass type. #### Signature - ```apex public static void validateType(String bypassType) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------ | ---------------------------- | +| Name | Type | Description | +|------|------|-------------| | bypassType | String | The bypass type to validate. | #### Return Type - **void** #### Throws - IllegalArgumentException: if the bypass type is not valid. --- @@ -164,19 +142,16 @@ IllegalArgumentException: if the bypass type is not valid. This method executes the Flow for the specified list of records before the insert of the records. #### Signature - ```apex public void beforeInsert(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type - **void** --- @@ -186,19 +161,16 @@ public void beforeInsert(List triggerNew) This method executes the Flow for the specified list of records after the insert of the records. #### Signature - ```apex public void afterInsert(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type - **void** --- @@ -208,20 +180,17 @@ public void afterInsert(List triggerNew) This method executes the Flow for the specified list of records before the update of the records. #### Signature - ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type - **void** --- @@ -231,20 +200,17 @@ public void beforeUpdate(List triggerNew, List triggerOld) This method executes the Flow for the specified list of records after the update of the records. #### Signature - ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type - **void** --- @@ -254,19 +220,16 @@ public void afterUpdate(List triggerNew, List triggerOld) This method executes the Flow for the specified list of records before the delete of the records. #### Signature - ```apex public void beforeDelete(List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type - **void** --- @@ -276,19 +239,16 @@ public void beforeDelete(List triggerOld) This method executes the Flow for the specified list of records after the delete of the records. #### Signature - ```apex public void afterDelete(List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type - **void** --- @@ -298,17 +258,14 @@ public void afterDelete(List triggerOld) This method executes the Flow for the specified list of records before the undelete of the records. #### Signature - ```apex public void afterUndelete(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of records that are being restored. | #### Return Type - -**void** +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowAddError.md b/docs/trigger-actions-framework/TriggerActionFlowAddError.md index 3356e9f..21b9c43 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowAddError.md +++ b/docs/trigger-actions-framework/TriggerActionFlowAddError.md @@ -1,22 +1,21 @@ # 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. - ---- - +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` @@ -24,41 +23,34 @@ If the `fieldName` property is not specified, the error message will be added to This Invocable method adds an error to an sObject. #### Signature - ```apex public static void addError(List requests) ``` #### Parameters - -| Name | Type | Description | -| -------- | ------------------- | ---------------------------- | +| 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 --- @@ -68,13 +60,11 @@ SObject `INVOCABLEVARIABLE` ###### Signature - ```apex public fieldName ``` ###### Type - String --- @@ -84,11 +74,9 @@ String `INVOCABLEVARIABLE` ###### Signature - ```apex public errorMessage ``` ###### Type - -String +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowBypass.md b/docs/trigger-actions-framework/TriggerActionFlowBypass.md index 16608f7..3529b5e 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowBypass.md +++ b/docs/trigger-actions-framework/TriggerActionFlowBypass.md @@ -2,18 +2,17 @@ `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. +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` @@ -21,41 +20,34 @@ Each `Request` object contains the following properties: 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 | -| -------- | ------------------- | ---------------------------- | +| 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 --- @@ -65,11 +57,9 @@ String `INVOCABLEVARIABLE` ###### Signature - ```apex public bypassType ``` ###### Type - -String +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md b/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md index 54fccee..72b4a22 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md +++ b/docs/trigger-actions-framework/TriggerActionFlowBypassProcessor.md @@ -1,36 +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 +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 | -| ----------- | ------ | ------------------------------------------------------------------------------- | +| 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. | +| requestName | String | The name of the trigger action flow, Apex class, or Object trigger to bypass. | #### Return Type - -**void** +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md b/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md index 83e9659..ecc0bfa 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md +++ b/docs/trigger-actions-framework/TriggerActionFlowChangeEvent.md @@ -1,15 +1,15 @@ # 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 +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 @@ -19,107 +19,92 @@ as the input variable. [TriggerActionFlow](TriggerActionFlow.md) ## Fields - ### `flowName` -_Inherited_ +*Inherited* #### Signature - ```apex public flowName ``` #### Type - String --- ### `allowRecursion` -_Inherited_ +*Inherited* #### Signature - ```apex public allowRecursion ``` #### Type - Boolean ## Methods - ### `bypass(flowName)` -_Inherited_ +*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 | -| -------- | ------ | ----------------------------------- | +| Name | Type | Description | +|------|------|-------------| | flowName | String | The API name of the Flow to bypass. | #### Return Type - **void** --- ### `clearBypass(flowName)` -_Inherited_ +*Inherited* This method clears the bypass for the specified list of records. #### Signature - ```apex public static void clearBypass(String flowName) ``` #### Parameters - -| Name | Type | Description | -| -------- | ------ | ------------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | flowName | String | The API name of the Flow to clear the bypass for. | #### Return Type - **void** --- ### `isBypassed(flowName)` -_Inherited_ +*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 | -| -------- | ------ | ------------------------------------------------- | +| 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. @@ -128,214 +113,187 @@ public static Boolean isBypassed(String flowName) ### `clearAllBypasses()` -_Inherited_ +*Inherited* This method clears all bypasses for all Flows. #### Signature - ```apex public static void clearAllBypasses() ``` #### Return Type - **void** --- ### `validateType(bypassType)` -_Inherited_ +*Inherited* This method validates the specified bypass type. #### Signature - ```apex public static void validateType(String bypassType) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------ | ---------------------------- | +| Name | Type | Description | +|------|------|-------------| | bypassType | String | The bypass type to validate. | #### Return Type - **void** #### Throws - IllegalArgumentException: if the bypass type is not valid. --- ### `beforeInsert(triggerNew)` -_Inherited_ +*Inherited* This method executes the Flow for the specified list of records before the insert of the records. #### Signature - ```apex public void beforeInsert(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type - **void** --- ### `afterInsert(triggerNew)` -_Inherited_ +*Inherited* This method executes the Flow for the specified list of records after the insert of the records. #### Signature - ```apex public void afterInsert(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of records to execute the Flow for. | #### Return Type - **void** --- ### `beforeUpdate(triggerNew, triggerOld)` -_Inherited_ +*Inherited* This method executes the Flow for the specified list of records before the update of the records. #### Signature - ```apex public void beforeUpdate(List triggerNew, List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type - **void** --- ### `afterUpdate(triggerNew, triggerOld)` -_Inherited_ +*Inherited* This method executes the Flow for the specified list of records after the update of the records. #### Signature - ```apex public void afterUpdate(List triggerNew, List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of new records that are being updated. | | triggerOld | List<SObject> | The list of old records that are being updated. | #### Return Type - **void** --- ### `beforeDelete(triggerOld)` -_Inherited_ +*Inherited* This method executes the Flow for the specified list of records before the delete of the records. #### Signature - ```apex public void beforeDelete(List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type - **void** --- ### `afterDelete(triggerOld)` -_Inherited_ +*Inherited* This method executes the Flow for the specified list of records after the delete of the records. #### Signature - ```apex public void afterDelete(List triggerOld) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | ----------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerOld | List<SObject> | The list of old records that are being deleted. | #### Return Type - **void** --- ### `afterUndelete(triggerNew)` -_Inherited_ +*Inherited* This method executes the Flow for the specified list of records before the undelete of the records. #### Signature - ```apex public void afterUndelete(List triggerNew) ``` #### Parameters - -| Name | Type | Description | -| ---------- | ------------------- | -------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | triggerNew | List<SObject> | The list of records that are being restored. | #### Return Type - -**void** +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md b/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md index cfb820f..9149b69 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md +++ b/docs/trigger-actions-framework/TriggerActionFlowClearAllBypasses.md @@ -2,21 +2,20 @@ `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 - ### `clearAllBypasses(requests)` `INVOCABLEMETHOD` @@ -24,17 +23,14 @@ The `clearAllBypasses` method will clear all bypasses for the specified objects, This method clears all bypasses for the specified objects, Apex actions, or Flow actions. #### Signature - ```apex public static void clearAllBypasses(List requests) ``` #### Parameters - -| Name | Type | Description | -| -------- | ------------------ | ------------------------------------------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | requests | List<String> | A list of the objects, Apex actions, or Flow actions to clear the bypasses for. | #### Return Type - -**void** +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md b/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md index 69c977c..dd8d049 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md +++ b/docs/trigger-actions-framework/TriggerActionFlowClearBypass.md @@ -2,21 +2,20 @@ `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 `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` @@ -24,47 +23,40 @@ The `clearBypass` method will clear the bypass for the specified objects, Apex a 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 | -| -------- | ------------------- | ------------------------------------------------------------------------------- | +| 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. +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 --- @@ -74,11 +66,9 @@ String `INVOCABLEVARIABLE` ###### Signature - ```apex public bypassType ``` ###### Type - -String +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md b/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md index c7989d8..8f57ff6 100644 --- a/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md +++ b/docs/trigger-actions-framework/TriggerActionFlowIsBypassed.md @@ -2,75 +2,67 @@ `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 +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, +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 | -| -------- | ------------------- | ------------------------------------------------------------------------------- | +| 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. +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 --- @@ -80,11 +72,9 @@ String `INVOCABLEVARIABLE` ###### Signature - ```apex public bypassType ``` ###### Type - -String +String \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerBase.md b/docs/trigger-actions-framework/TriggerBase.md index 6caa127..77efa76 100644 --- a/docs/trigger-actions-framework/TriggerBase.md +++ b/docs/trigger-actions-framework/TriggerBase.md @@ -1,83 +1,71 @@ # 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 `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` +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 +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 | -| ----------- | ------ | ------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | sObjectName | String | The API name of the object to bypass. | #### Return Type - **void** --- @@ -87,19 +75,16 @@ public static void bypass(String sObjectName) This method clears the bypass for the specified object. #### Signature - ```apex public static void clearBypass(String sObjectName) ``` #### Parameters - -| Name | Type | Description | -| ----------- | ------ | --------------------------------------------------- | +| Name | Type | Description | +|------|------|-------------| | sObjectName | String | The API name of the object to clear the bypass for. | #### Return Type - **void** --- @@ -109,19 +94,16 @@ public static void clearBypass(String sObjectName) This method checks if the specified object is bypassed. #### Signature - ```apex public static Boolean isBypassed(String sObjectName) ``` #### Parameters - -| Name | Type | Description | -| ----------- | ------ | --------------------------------------------------- | +| 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. @@ -133,13 +115,11 @@ True if the object is bypassed, false otherwise. This method clears all bypasses. #### Signature - ```apex public static void clearAllBypasses() ``` #### Return Type - **void** --- @@ -149,13 +129,11 @@ public static void clearAllBypasses() This method offsets the number of existing DML rows. #### Signature - ```apex public static void offsetExistingDmlRows() ``` #### Return Type - **void** --- @@ -165,13 +143,11 @@ public static void offsetExistingDmlRows() This method waits to finalize the DML operation. #### Signature - ```apex public static void waitToFinalize() ``` #### Return Type - **void** --- @@ -181,13 +157,11 @@ public static void waitToFinalize() This method now finalizes the DML operation. #### Signature - ```apex public static void nowFinalize() ``` #### Return Type - **void** --- @@ -197,11 +171,9 @@ public static void nowFinalize() This method runs the trigger handler. #### Signature - ```apex public void run() ``` #### Return Type - -**void** +**void** \ No newline at end of file diff --git a/docs/trigger-actions-framework/TriggerTestUtility.md b/docs/trigger-actions-framework/TriggerTestUtility.md index fbc9c03..5783ba3 100644 --- a/docs/trigger-actions-framework/TriggerTestUtility.md +++ b/docs/trigger-actions-framework/TriggerTestUtility.md @@ -2,35 +2,31 @@ `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: - +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 | -| ----------- | ------------------ | ------------------------------------------- | +| 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. +A fake ID for the specified sObject type. \ No newline at end of file diff --git a/package.json b/package.json index 01bea72..a2a0ecf 100644 --- a/package.json +++ b/package.json @@ -1,34 +1,34 @@ { - "name": "apex-trigger-actions-framework", - "private": true, - "version": "1.0.0", - "description": "Apex Trigger Actions Framework", - "scripts": { - "precommit": "lint-staged", - "prepare": "husky", - "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", - "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"" - }, - "devDependencies": { - "@prettier/plugin-xml": "^3.4.1", - "eslint": "^9.22.0", - "eslint-config-prettier": "^10.1.1", - "husky": "^9.1.7", - "lint-staged": "^15.5.0", - "prettier": "3.5.3", - "prettier-plugin-apex": "2.2.5" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ - "prettier --write" - ], - "**/{aura|lwc}/**": [ - "eslint" - ] - } + "name": "apex-trigger-actions-framework", + "private": true, + "version": "1.0.0", + "description": "Apex Trigger Actions Framework", + "scripts": { + "precommit": "lint-staged", + "prepare": "husky", + "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", + "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"" + }, + "devDependencies": { + "@prettier/plugin-xml": "^3.4.1", + "eslint": "^9.22.0", + "eslint-config-prettier": "^10.1.1", + "husky": "^9.1.7", + "lint-staged": "^15.5.0", + "prettier": "3.5.3", + "prettier-plugin-apex": "2.2.5" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ + "prettier --write" + ], + "**/{aura|lwc}/**": [ + "eslint" + ] + } } diff --git a/sfdx-project.json b/sfdx-project.json index b333369..1422e07 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -1,48 +1,48 @@ { - "packageDirectories": [ - { - "path": "trigger-actions-framework", - "default": true, - "package": "Trigger Actions Framework", - "versionName": "Version 0.3", - "versionNumber": "0.3.1.NEXT" - } - ], - "namespace": "", - "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "63.0", - "packageAliases": { - "Trigger Actions Framework": "0Ho3h0000008Om4CAE", - "Trigger Actions Framework@0.1.0-1": "04t3h000004VaHaAAK", - "Trigger Actions Framework@0.1.2": "04t3h000004VaIdAAK", - "Trigger Actions Framework@0.1.3": "04t3h000004VaInAAK", - "Trigger Actions Framework@0.1.4-0": "04t3h000004VaJWAA0", - "Trigger Actions Framework@0.1.4-1": "04t3h000004VaJbAAK", - "Trigger Actions Framework@0.1.5-0": "04t3h000004VaJqAAK", - "Trigger Actions Framework@0.1.6": "04t3h000004VaLDAA0", - "Trigger Actions Framework@0.1.7": "04t3h000004VaLIAA0", - "Trigger Actions Framework@0.1.8": "04t3h000004VaLNAA0", - "Trigger Actions Framework@0.1.9": "04t3h000004VaLSAA0", - "Trigger Actions Framework@0.2.0": "04t3h000004VaLmAAK", - "Trigger Actions Framework@0.2.1": "04t3h000004VaVFAA0", - "Trigger Actions Framework@0.2.2-1": "04t3h000004OYREAA4", - "Trigger Actions Framework@0.2.3-1": "04t3h000004OYTKAA4", - "Trigger Actions Framework@0.2.5-1": "04t3h000004OYUDAA4", - "Trigger Actions Framework@0.2.6-1": "04t3h000004juLaAAI", - "Trigger Actions Framework@0.2.8": "04t3h000004juLuAAI", - "Trigger Actions Framework@0.2.9": "04t3h000004juNCAAY", - "Trigger Actions Framework@0.2.9-1": "04t3h000004juNHAAY", - "Trigger Actions Framework@0.2.10": "04t3h000004juNRAAY", - "Trigger Actions Framework@0.2.11": "04tKY000000Pb8tYAC", - "Trigger Actions Framework@0.3.0": "04tKY000000Pb8ZYAS", - "Trigger Actions Framework@0.3.1-0": "04tKY000000Pd90YAC", - "Trigger Actions Framework@0.3.1-1": "04tKY000000Pd95YAC", - "Trigger Actions Framework@0.3.1-2": "04tKY000000Pd9AYAS", - "Trigger Actions Framework@0.3.1-3": "04tKY000000PdYBYA0", - "Trigger Actions Framework@0.3.1-4": "04tKY000000PdYGYA0", - "Trigger Actions Framework@0.3.1-5": "04tKY000000PdYaYAK", - "Trigger Actions Framework@0.3.1-6": "04tKY000000PdZ9YAK", - "Trigger Actions Framework@0.3.1-7": "04tKY000000PdZJYA0", - "Trigger Actions Framework@0.3.2": "04tKY000000PdZOYA0" - } -} + "packageDirectories": [ + { + "path": "trigger-actions-framework", + "default": true, + "package": "Trigger Actions Framework", + "versionName": "Version 0.3", + "versionNumber": "0.3.1.NEXT" + } + ], + "namespace": "", + "sfdcLoginUrl": "https://login.salesforce.com", + "sourceApiVersion": "63.0", + "packageAliases": { + "Trigger Actions Framework": "0Ho3h0000008Om4CAE", + "Trigger Actions Framework@0.1.0-1": "04t3h000004VaHaAAK", + "Trigger Actions Framework@0.1.2": "04t3h000004VaIdAAK", + "Trigger Actions Framework@0.1.3": "04t3h000004VaInAAK", + "Trigger Actions Framework@0.1.4-0": "04t3h000004VaJWAA0", + "Trigger Actions Framework@0.1.4-1": "04t3h000004VaJbAAK", + "Trigger Actions Framework@0.1.5-0": "04t3h000004VaJqAAK", + "Trigger Actions Framework@0.1.6": "04t3h000004VaLDAA0", + "Trigger Actions Framework@0.1.7": "04t3h000004VaLIAA0", + "Trigger Actions Framework@0.1.8": "04t3h000004VaLNAA0", + "Trigger Actions Framework@0.1.9": "04t3h000004VaLSAA0", + "Trigger Actions Framework@0.2.0": "04t3h000004VaLmAAK", + "Trigger Actions Framework@0.2.1": "04t3h000004VaVFAA0", + "Trigger Actions Framework@0.2.2-1": "04t3h000004OYREAA4", + "Trigger Actions Framework@0.2.3-1": "04t3h000004OYTKAA4", + "Trigger Actions Framework@0.2.5-1": "04t3h000004OYUDAA4", + "Trigger Actions Framework@0.2.6-1": "04t3h000004juLaAAI", + "Trigger Actions Framework@0.2.8": "04t3h000004juLuAAI", + "Trigger Actions Framework@0.2.9": "04t3h000004juNCAAY", + "Trigger Actions Framework@0.2.9-1": "04t3h000004juNHAAY", + "Trigger Actions Framework@0.2.10": "04t3h000004juNRAAY", + "Trigger Actions Framework@0.2.11": "04tKY000000Pb8tYAC", + "Trigger Actions Framework@0.3.0": "04tKY000000Pb8ZYAS", + "Trigger Actions Framework@0.3.1-0": "04tKY000000Pd90YAC", + "Trigger Actions Framework@0.3.1-1": "04tKY000000Pd95YAC", + "Trigger Actions Framework@0.3.1-2": "04tKY000000Pd9AYAS", + "Trigger Actions Framework@0.3.1-3": "04tKY000000PdYBYA0", + "Trigger Actions Framework@0.3.1-4": "04tKY000000PdYGYA0", + "Trigger Actions Framework@0.3.1-5": "04tKY000000PdYaYAK", + "Trigger Actions Framework@0.3.1-6": "04tKY000000PdZ9YAK", + "Trigger Actions Framework@0.3.1-7": "04tKY000000PdZJYA0", + "Trigger Actions Framework@0.3.2": "04tKY000000PdZOYA0" + } +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls index 8d9c274..61b81f4 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls +++ b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls @@ -121,7 +121,10 @@ public with sharing virtual class FinalizerHandler { * @param finalizerMetadata The metadata of the finalizer to execute. * @param context The context to pass to the finalizer's `execute` method. */ - private void callReferencedFinalizer(DML_Finalizer__mdt finalizerMetadata, Context context) { + private void callReferencedFinalizer( + DML_Finalizer__mdt finalizerMetadata, + Context context + ) { Object dynamicInstance; String className = finalizerMetadata.Apex_Class_Name__c; if (FinalizerHandler.isBypassed(className)) { @@ -163,7 +166,9 @@ public with sharing virtual class FinalizerHandler { } private void handleFinalizerException(String errorFormat, String className) { - throw new FinalizerException(String.format(errorFormat, new List{ className })); + throw new FinalizerException( + String.format(errorFormat, new List{ className }) + ); } /** @@ -173,7 +178,10 @@ public with sharing virtual class FinalizerHandler { * @param requiredPermission The required permission for the finalizer. * @return True if bypassed, false otherwise. */ - private boolean isBypassed(String bypassPermission, String requiredPermission) { + private boolean isBypassed( + String bypassPermission, + String requiredPermission + ) { return (bypassPermission != null && permissionMap.get(bypassPermission)) || (requiredPermission != null && !permissionMap.get(requiredPermission)); } @@ -184,7 +192,10 @@ public with sharing virtual class FinalizerHandler { */ private void populatePermissionMap(String permissionName) { if (permissionName != null && !permissionMap.containsKey(permissionName)) { - permissionMap.put(permissionName, FeatureManagement.checkPermission(permissionName)); + permissionMap.put( + permissionName, + FeatureManagement.checkPermission(permissionName) + ); } } @@ -220,7 +231,8 @@ public with sharing virtual class FinalizerHandler { * equal to, or greater than the specified object. */ public Integer compareTo(Object other) { - Decimal difference = (this.metadata.Order__c - ((FinalizerSorter) other).metadata.Order__c); + Decimal difference = (this.metadata.Order__c - + ((FinalizerSorter) other).metadata.Order__c); return difference < 0 ? -1 : difference == 0 ? 0 : 1; } } @@ -237,4 +249,4 @@ public with sharing virtual class FinalizerHandler { */ private class FinalizerException extends Exception { } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls index 1c89cc7..637fbb8 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls +++ b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls @@ -94,7 +94,10 @@ private with sharing class FinalizerHandlerTest { @IsTest private static void staticallyBypassedFinalizerShouldNotExecute() { handler.allFinalizers = new List{ - new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_FOO_FINALIZER, Order__c = 1) + new DML_Finalizer__mdt( + Apex_Class_Name__c = TEST_FOO_FINALIZER, + Order__c = 1 + ) }; FinalizerHandler.bypass(TEST_FOO_FINALIZER); @@ -147,8 +150,14 @@ private with sharing class FinalizerHandlerTest { @IsTest private static void finalizersShouldExecuteInOrder() { handler.allFinalizers = new List{ - new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_FOO_FINALIZER, Order__c = 1), - new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_BAR_FINALIZER, Order__c = 2) + new DML_Finalizer__mdt( + Apex_Class_Name__c = TEST_FOO_FINALIZER, + Order__c = 1 + ), + new DML_Finalizer__mdt( + Apex_Class_Name__c = TEST_BAR_FINALIZER, + Order__c = 2 + ) }; handler.handleDynamicFinalizers(); @@ -204,7 +213,10 @@ private with sharing class FinalizerHandlerTest { System.Assert.isNotNull(myException, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format(FinalizerHandler.INVALID_TYPE_ERROR_FINALIZER, new List{ MY_CLASS }), + String.format( + FinalizerHandler.INVALID_TYPE_ERROR_FINALIZER, + new List{ MY_CLASS } + ), myException.getMessage(), EXCEPTION_SHOULD_HAVE_CORRECT_MESSAGE ); @@ -295,4 +307,4 @@ private with sharing class FinalizerHandlerTest { Database.setSavepoint(); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls index a72ae1c..6a28a43 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls @@ -113,4 +113,4 @@ public with sharing class FlowChangeEventHeader { public Integer hashCode() { return JSON.serialize(this).hashCode(); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls index 2cf5e7d..32db838 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls @@ -23,7 +23,10 @@ private with sharing class FlowChangeEventHeaderTest { @IsTest private static void shouldBeAbleToConstruct() { - System.Assert.isNotNull(header, 'Unable to construct a FlowChangeEventHeader'); + System.Assert.isNotNull( + header, + 'Unable to construct a FlowChangeEventHeader' + ); } @IsTest @@ -33,7 +36,9 @@ private with sharing class FlowChangeEventHeaderTest { @IsTest private static void shouldBeAbleToCompare() { - FlowChangeEventHeader other = new FlowChangeEventHeader(new EventBus.ChangeEventHeader()); + FlowChangeEventHeader other = new FlowChangeEventHeader( + new EventBus.ChangeEventHeader() + ); other.changeType = 'CREATE'; System.Assert.areEqual( @@ -52,4 +57,4 @@ private with sharing class FlowChangeEventHeaderTest { 'Unable to detect difference between FlowChangeEventHeader and null' ); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FormulaFilter.cls b/trigger-actions-framework/main/default/classes/FormulaFilter.cls index 37dd400..842eda5 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilter.cls +++ b/trigger-actions-framework/main/default/classes/FormulaFilter.cls @@ -23,7 +23,8 @@ global class FormulaFilter { private static final String ERROR_PREFIX = 'Please check the `SObject_Trigger_Setting__mdt` metadata for the the {0} sObject.'; @TestVisible private static final String MISSING_CLASS_NAME = - ERROR_PREFIX + ' The record is missing the `TriggerRecord_Class_Name__c` field.'; + ERROR_PREFIX + + ' The record is missing the `TriggerRecord_Class_Name__c` field.'; @TestVisible private static final String INVALID_CLASS = ERROR_PREFIX + @@ -73,14 +74,18 @@ global class FormulaFilter { List triggerOld ) { FormulaFilter.Result result = new FormulaFilter.Result(); - String entryCriteriaFormula = this.triggerActionConfiguration?.Entry_Criteria__c; + String entryCriteriaFormula = this.triggerActionConfiguration + ?.Entry_Criteria__c; if (String.isBlank(entryCriteriaFormula)) { result.triggerNew = triggerNew; result.triggerOld = triggerOld; return result; } - String nameOfType = getNameOfType(this.triggerActionConfiguration, this.context); + String nameOfType = getNameOfType( + this.triggerActionConfiguration, + this.context + ); System.Type triggerRecordSubType = getType(nameOfType); FormulaEval.FormulaInstance fx = getFormulaInstance( triggerRecordSubType, @@ -92,7 +97,10 @@ global class FormulaFilter { for (Integer i = 0; i < size; i++) { SObject record = triggerNew?.get(i); SObject recordPrior = triggerOld?.get(i); - TriggerRecord toProcess = getTriggerRecord(triggerRecordSubType, nameOfType); + TriggerRecord toProcess = getTriggerRecord( + triggerRecordSubType, + nameOfType + ); toProcess.newSobject = record; toProcess.oldSobject = recordPrior; if ((Boolean) fx.evaluate(toProcess)) { @@ -112,19 +120,28 @@ global class FormulaFilter { System.Type response = System.Type.forName(className); if (response == null) { throw new IllegalArgumentException( - String.format(INVALID_CLASS, new List{ this.sObjectName, className }) + String.format( + INVALID_CLASS, + new List{ this.sObjectName, className } + ) ); } return response; } - private TriggerRecord getTriggerRecord(System.Type triggerRecordSubType, String nameOfType) { + private TriggerRecord getTriggerRecord( + System.Type triggerRecordSubType, + String nameOfType + ) { TriggerRecord dynamicInstance; try { dynamicInstance = (TriggerRecord) triggerRecordSubType.newInstance(); } catch (System.TypeException e) { throw new IllegalArgumentException( - String.format(INVALID_SUBTYPE, new List{ this.sObjectName, nameOfType }) + String.format( + INVALID_SUBTYPE, + new List{ this.sObjectName, nameOfType } + ) ); } return dynamicInstance; @@ -187,4 +204,4 @@ global class FormulaFilter { this.triggerOld = new List(); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml b/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FormulaFilter.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls index 6ed1d4d..478d9be 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls +++ b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls @@ -13,7 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -@SuppressWarnings('PMD.ApexUnitTestClassShouldHaveRunAs, PMD.AvoidGlobalModifier') +@SuppressWarnings( + 'PMD.ApexUnitTestClassShouldHaveRunAs, PMD.AvoidGlobalModifier' +) @IsTest global class FormulaFilterTest { private static final String ACCOUNT_SOBJECT_NAME = 'Account'; @@ -43,10 +45,21 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); + FormulaFilter.Result result = filter.filterByEntryCriteria( + triggerNew, + triggerOld + ); - System.Assert.areEqual(2, result.triggerNew.size(), 'The size of triggerNew should be 2'); - System.Assert.areEqual(2, result.triggerOld.size(), 'The size of triggerOld should be 2'); + System.Assert.areEqual( + 2, + result.triggerNew.size(), + 'The size of triggerNew should be 2' + ); + System.Assert.areEqual( + 2, + result.triggerOld.size(), + 'The size of triggerOld should be 2' + ); } @IsTest @@ -59,10 +72,21 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); + FormulaFilter.Result result = filter.filterByEntryCriteria( + triggerNew, + triggerOld + ); - System.Assert.areEqual(2, result.triggerNew.size(), 'The size of triggerNew should be 2'); - System.Assert.areEqual(2, result.triggerOld.size(), 'The size of triggerNew should be 2'); + System.Assert.areEqual( + 2, + result.triggerNew.size(), + 'The size of triggerNew should be 2' + ); + System.Assert.areEqual( + 2, + result.triggerOld.size(), + 'The size of triggerNew should be 2' + ); } @IsTest @@ -74,15 +98,26 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); + FormulaFilter.Result result = filter.filterByEntryCriteria( + triggerNew, + triggerOld + ); - System.Assert.areEqual(1, result.triggerNew.size(), 'There should be 1 record in triggerNew'); + System.Assert.areEqual( + 1, + result.triggerNew.size(), + 'There should be 1 record in triggerNew' + ); System.Assert.areEqual( 'Test Account 1', ((Account) result.triggerNew[0]).Name, 'The first record triggerNew should have a name of Test Account 1' ); - System.Assert.areEqual(1, result.triggerOld.size(), 'There should be 1 record in triggerNew'); + System.Assert.areEqual( + 1, + result.triggerOld.size(), + 'There should be 1 record in triggerNew' + ); System.Assert.areEqual( 'Test Account 1', ((Account) result.triggerOld[0]).Name, @@ -99,11 +134,20 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); + FormulaFilter.Result result = filter.filterByEntryCriteria( + triggerNew, + triggerOld + ); System.Assert.isNotNull(result, 'result should not be null'); - System.Assert.isTrue(result.triggerNew.isEmpty(), 'triggerNew should be empty'); - System.Assert.isTrue(result.triggerOld.isEmpty(), 'triggerOld should be empty'); + System.Assert.isTrue( + result.triggerNew.isEmpty(), + 'triggerNew should be empty' + ); + System.Assert.isTrue( + result.triggerOld.isEmpty(), + 'triggerOld should be empty' + ); } @IsTest @@ -124,7 +168,10 @@ global class FormulaFilterTest { System.Assert.isNotNull(caught, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format(FormulaFilter.MISSING_CLASS_NAME, new List{ ACCOUNT_SOBJECT_NAME }), + String.format( + FormulaFilter.MISSING_CLASS_NAME, + new List{ ACCOUNT_SOBJECT_NAME } + ), caught.getMessage(), 'The exception message should match the expected error' ); @@ -148,7 +195,10 @@ global class FormulaFilterTest { System.Assert.isNotNull(caught, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format(FormulaFilter.MISSING_CLASS_NAME, new List{ ACCOUNT_SOBJECT_NAME }), + String.format( + FormulaFilter.MISSING_CLASS_NAME, + new List{ ACCOUNT_SOBJECT_NAME } + ), caught.getMessage(), 'The exception message should match the expected error' ); @@ -206,7 +256,10 @@ global class FormulaFilterTest { System.Assert.areEqual( String.format( FormulaFilter.INVALID_SUBTYPE, - new List{ ACCOUNT_SOBJECT_NAME, sobjectSetting.TriggerRecord_Class_Name__c } + new List{ + ACCOUNT_SOBJECT_NAME, + sobjectSetting.TriggerRecord_Class_Name__c + } ), caught.getMessage(), 'The exception message should match the expected error' @@ -232,7 +285,10 @@ global class FormulaFilterTest { System.Assert.areEqual( String.format( FormulaFilter.INVALID_CLASS, - new List{ ACCOUNT_SOBJECT_NAME, sobjectSetting.TriggerRecord_Class_Name__c } + new List{ + ACCOUNT_SOBJECT_NAME, + sobjectSetting.TriggerRecord_Class_Name__c + } ), caught.getMessage(), 'The exception message should match the expected error' @@ -312,4 +368,4 @@ global class FormulaFilterTest { } } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls index 04e4a34..a4fa549 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls @@ -235,7 +235,10 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private void populatePermissionMap(String permissionName) { if (permissionName != null && !permissionMap.containsKey(permissionName)) { - permissionMap.put(permissionName, FeatureManagement.checkPermission(permissionName)); + permissionMap.put( + permissionName, + FeatureManagement.checkPermission(permissionName) + ); } } @@ -247,9 +250,15 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private list getActionMetadata(String relationshipName) { if (!sObjectToContextToActions.containsKey(this.sObjectName)) { - sObjectToContextToActions.put(this.sObjectName, new Map>()); + sObjectToContextToActions.put( + this.sObjectName, + new Map>() + ); } - if (!sObjectToContextToActions.get(this.sObjectName).containsKey(relationshipName)) { + if ( + !sObjectToContextToActions.get(this.sObjectName) + .containsKey(relationshipName) + ) { list result = new List(); String sObjectLocalName = this.sObjectName; List split = sObjectName.split(DOUBLE_UNDERSCORE); @@ -270,16 +279,20 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem } ); for ( - Trigger_Action__mdt actionMetadata : (List) selector.query(queryString) + Trigger_Action__mdt actionMetadata : (List) selector.query( + queryString + ) ) { if (shouldExecute(actionMetadata, relationshipName)) { result.add(actionMetadata); } } - sObjectToContextToActions.get(this.sObjectName).put(relationshipName, result); + sObjectToContextToActions.get(this.sObjectName) + .put(relationshipName, result); } - return sObjectToContextToActions.get(this.sObjectName).get(relationshipName); + return sObjectToContextToActions.get(this.sObjectName) + .get(relationshipName); } /** @@ -289,7 +302,10 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param relationshipName The name of the relationship. * @return True if the Trigger Action should be executed, false otherwise. */ - private Boolean shouldExecute(Trigger_Action__mdt actionMetadata, String relationshipName) { + private Boolean shouldExecute( + Trigger_Action__mdt actionMetadata, + String relationshipName + ) { String sObjectBypassPermissionName = (String) ((sObject_Trigger_Setting__mdt) actionMetadata.getSobject( relationshipName + RELATIONSHIP_SUFFIX )) @@ -312,7 +328,8 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem return !isBypassed( actionMetadata.Bypass_Permission__c, actionMetadata.Required_Permission__c - ) && !isBypassed(sObjectBypassPermissionName, sObjectRequiredPermissionName); + ) && + !isBypassed(sObjectBypassPermissionName, sObjectRequiredPermissionName); } /** @@ -322,7 +339,10 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param requiredPermission The required permission for the Trigger Action. * @return True if bypassed, false otherwise. */ - private static boolean isBypassed(String bypassPermission, String requiredPermission) { + private static boolean isBypassed( + String bypassPermission, + String requiredPermission + ) { return (bypassPermission != null && permissionMap.get(bypassPermission)) || (requiredPermission != null && !permissionMap.get(requiredPermission)); } @@ -344,8 +364,16 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem if (!canExecute(triggerMetadata)) { continue; } - this.validateType(context, triggerAction, triggerMetadata.Apex_Class_Name__c); - FormulaFilter.Result filtered = new FormulaFilter(triggerMetadata, context, this.sObjectName) + this.validateType( + context, + triggerAction, + triggerMetadata.Apex_Class_Name__c + ); + FormulaFilter.Result filtered = new FormulaFilter( + triggerMetadata, + context, + this.sObjectName + ) .filterByEntryCriteria(triggerNew, triggerOld); if ( @@ -359,10 +387,12 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem switch on context { when BEFORE_INSERT { - ((TriggerAction.BeforeInsert) triggerAction).beforeInsert(filtered.triggerNew); + ((TriggerAction.BeforeInsert) triggerAction) + .beforeInsert(filtered.triggerNew); } when AFTER_INSERT { - ((TriggerAction.AfterInsert) triggerAction).afterInsert(filtered.triggerNew); + ((TriggerAction.AfterInsert) triggerAction) + .afterInsert(filtered.triggerNew); } when BEFORE_UPDATE { ((TriggerAction.BeforeUpdate) triggerAction) @@ -373,13 +403,16 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem .afterUpdate(filtered.triggerNew, filtered.triggerOld); } when BEFORE_DELETE { - ((TriggerAction.BeforeDelete) triggerAction).beforeDelete(filtered.triggerOld); + ((TriggerAction.BeforeDelete) triggerAction) + .beforeDelete(filtered.triggerOld); } when AFTER_DELETE { - ((TriggerAction.AfterDelete) triggerAction).afterDelete(filtered.triggerOld); + ((TriggerAction.AfterDelete) triggerAction) + .afterDelete(filtered.triggerOld); } when AFTER_UNDELETE { - ((TriggerAction.AfterUndelete) triggerAction).afterUndelete(filtered.triggerNew); + ((TriggerAction.AfterUndelete) triggerAction) + .afterUndelete(filtered.triggerNew); } } } @@ -392,7 +425,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param context The TriggerOperation context for which to retrieve metadata. * @return A List of Trigger_Action__mdt metadata records corresponding to the given context. */ - private List getActionMetadata(TriggerOperation context) { + private List getActionMetadata( + TriggerOperation context + ) { List result; switch on context { when BEFORE_INSERT { @@ -439,10 +474,15 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem result = Type.forName(triggerMetadata.Apex_Class_Name__c).newInstance(); if (triggerMetadata.Flow_Name__c != null) { ((TriggerActionFlow) result).flowName = triggerMetadata.Flow_Name__c; - ((TriggerActionFlow) result).allowRecursion = triggerMetadata.Allow_Flow_Recursion__c; + ((TriggerActionFlow) result) + .allowRecursion = triggerMetadata.Allow_Flow_Recursion__c; } } catch (System.NullPointerException e) { - handleException(INVALID_CLASS_ERROR, triggerMetadata.Apex_Class_Name__c, context); + handleException( + INVALID_CLASS_ERROR, + triggerMetadata.Apex_Class_Name__c, + context + ); } return result; } @@ -456,8 +496,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @return True if the trigger action can be executed, false otherwise. */ private Boolean canExecute(Trigger_Action__mdt triggerMetadata) { - return !MetadataTriggerHandler.isBypassed(triggerMetadata.Apex_Class_Name__c) && - !TriggerBase.isBypassed(this.sObjectName); + return !MetadataTriggerHandler.isBypassed( + triggerMetadata.Apex_Class_Name__c + ) && !TriggerBase.isBypassed(this.sObjectName); } /** @@ -467,7 +508,11 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param triggerAction The Trigger Action object. * @param className The name of the Trigger Action class. */ - private void validateType(TriggerOperation context, Object triggerAction, String className) { + private void validateType( + TriggerOperation context, + Object triggerAction, + String className + ) { try { switch on context { when BEFORE_INSERT { @@ -504,11 +549,19 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param className The name of the Trigger Action class. * @param triggerOperation The Trigger Operation context. */ - private void handleException(String error, String className, TriggerOperation triggerOperation) { + private void handleException( + String error, + String className, + TriggerOperation triggerOperation + ) { throw new MetadataTriggerHandlerException( String.format( error, - new List{ className, String.valueOf(triggerOperation), this.sObjectName } + new List{ + className, + String.valueOf(triggerOperation), + this.sObjectName + } ) ); } @@ -522,7 +575,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeInsertActionMetadata { get { if (beforeInsertActionMetadata == null) { - beforeInsertActionMetadata = getActionMetadata(TriggerOperation.BEFORE_INSERT.name()); + beforeInsertActionMetadata = getActionMetadata( + TriggerOperation.BEFORE_INSERT.name() + ); } return beforeInsertActionMetadata; } @@ -538,7 +593,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterInsertActionMetadata { get { if (afterInsertActionMetadata == null) { - afterInsertActionMetadata = getActionMetadata(TriggerOperation.AFTER_INSERT.name()); + afterInsertActionMetadata = getActionMetadata( + TriggerOperation.AFTER_INSERT.name() + ); } return afterInsertActionMetadata; } @@ -554,7 +611,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeUpdateActionMetadata { get { if (beforeUpdateActionMetadata == null) { - beforeUpdateActionMetadata = getActionMetadata(TriggerOperation.BEFORE_UPDATE.name()); + beforeUpdateActionMetadata = getActionMetadata( + TriggerOperation.BEFORE_UPDATE.name() + ); } return beforeUpdateActionMetadata; } @@ -570,7 +629,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterUpdateActionMetadata { get { if (afterUpdateActionMetadata == null) { - afterUpdateActionMetadata = getActionMetadata(TriggerOperation.AFTER_UPDATE.name()); + afterUpdateActionMetadata = getActionMetadata( + TriggerOperation.AFTER_UPDATE.name() + ); } return afterUpdateActionMetadata; } @@ -586,7 +647,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeDeleteActionMetadata { get { if (beforeDeleteActionMetadata == null) { - beforeDeleteActionMetadata = getActionMetadata(TriggerOperation.BEFORE_DELETE.name()); + beforeDeleteActionMetadata = getActionMetadata( + TriggerOperation.BEFORE_DELETE.name() + ); } return beforeDeleteActionMetadata; } @@ -602,7 +665,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterDeleteActionMetadata { get { if (afterDeleteActionMetadata == null) { - afterDeleteActionMetadata = getActionMetadata(TriggerOperation.AFTER_DELETE.name()); + afterDeleteActionMetadata = getActionMetadata( + TriggerOperation.AFTER_DELETE.name() + ); } return afterDeleteActionMetadata; } @@ -618,7 +683,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterUndeleteActionMetadata { get { if (afterUndeleteActionMetadata == null) { - afterUndeleteActionMetadata = getActionMetadata(TriggerOperation.AFTER_UNDELETE.name()); + afterUndeleteActionMetadata = getActionMetadata( + TriggerOperation.AFTER_UNDELETE.name() + ); } return afterUndeleteActionMetadata; } @@ -643,4 +710,4 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private class MetadataTriggerHandlerException extends Exception { } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls index 4110f09..20e394b 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls @@ -14,7 +14,9 @@ limitations under the License. */ -@SuppressWarnings('PMD.ApexDoc, PMD.CyclomaticComplexity, PMD.ApexUnitTestClassShouldHaveRunAs') +@SuppressWarnings( + 'PMD.ApexDoc, PMD.CyclomaticComplexity, PMD.ApexUnitTestClassShouldHaveRunAs' +) @IsTest(isParallel=true) private class MetadataTriggerHandlerTest { private static final String ACCOUNT = 'Account'; @@ -49,7 +51,9 @@ private class MetadataTriggerHandlerTest { ); private static sObject_Trigger_Setting__mdt setting = new sObject_Trigger_Setting__mdt( Object_API_Name__c = ACCOUNT, - Id = TriggerTestUtility.getFakeId(Schema.sObject_Trigger_Setting__mdt.SObjectType) + Id = TriggerTestUtility.getFakeId( + Schema.sObject_Trigger_Setting__mdt.SObjectType + ) ); private static MetadataTriggerHandler handler = new MetadataTriggerHandler(); private static Boolean executed = false; @@ -69,7 +73,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldSucceed() { - handler.beforeInsertActionMetadata = new List{ action }; + handler.beforeInsertActionMetadata = new List{ + action + }; handler.beforeInsert(handler.triggerNew); @@ -79,7 +85,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_AFTER_INSERT; - handler.beforeInsertActionMetadata = new List{ action }; + handler.beforeInsertActionMetadata = new List{ + action + }; try { handler.beforeInsert(handler.triggerNew); @@ -105,7 +113,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeInsertActionMetadata = new List{ action }; + handler.beforeInsertActionMetadata = new List{ + action + }; try { handler.beforeInsert(handler.triggerNew); @@ -193,7 +203,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldSucceed() { action.Apex_Class_Name__c = TEST_BEFORE_UPDATE; - handler.beforeUpdateActionMetadata = new List{ action }; + handler.beforeUpdateActionMetadata = new List{ + action + }; handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -203,7 +215,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.beforeUpdateActionMetadata = new List{ action }; + handler.beforeUpdateActionMetadata = new List{ + action + }; try { handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -229,7 +243,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeUpdateActionMetadata = new List{ action }; + handler.beforeUpdateActionMetadata = new List{ + action + }; try { handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -317,7 +333,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldSucceed() { action.Apex_Class_Name__c = TEST_BEFORE_DELETE; - handler.beforeDeleteActionMetadata = new List{ action }; + handler.beforeDeleteActionMetadata = new List{ + action + }; handler.beforeDelete(handler.triggerOld); @@ -327,7 +345,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.beforeDeleteActionMetadata = new List{ action }; + handler.beforeDeleteActionMetadata = new List{ + action + }; try { handler.beforeDelete(handler.triggerOld); @@ -353,7 +373,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeDeleteActionMetadata = new List{ action }; + handler.beforeDeleteActionMetadata = new List{ + action + }; try { handler.beforeDelete(handler.triggerOld); @@ -441,7 +463,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldSucceed() { action.Apex_Class_Name__c = TEST_AFTER_UNDELETE; - handler.afterUndeleteActionMetadata = new List{ action }; + handler.afterUndeleteActionMetadata = new List{ + action + }; handler.afterUndelete(handler.triggerOld); @@ -451,7 +475,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.afterUndeleteActionMetadata = new List{ action }; + handler.afterUndeleteActionMetadata = new List{ + action + }; try { handler.afterUndelete(handler.triggerOld); @@ -477,7 +503,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.afterUndeleteActionMetadata = new List{ action }; + handler.afterUndeleteActionMetadata = new List{ + action + }; try { handler.afterUndelete(handler.triggerOld); @@ -502,7 +530,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void nothingToProcessShouldExitEarly() { - handler.beforeInsertActionMetadata = new List{ action }; + handler.beforeInsertActionMetadata = new List{ + action + }; handler.beforeInsert(new List()); @@ -603,7 +633,9 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldExecuteIfNoRequiredOrBypassPermissionsAreDefinedForSObjectOrAction() { - MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.selector = new FakeSelector( + new List{ action } + ); MetadataTriggerHandler.permissionMap.clear(); @@ -616,7 +648,9 @@ private class MetadataTriggerHandlerTest { private static void actionShouldExecuteIfUserDoesNotHaveBypassPermissionForSObjectOrAction() { setting.Bypass_Permission__c = BYPASS_PERMISSION; action.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.selector = new FakeSelector( + new List{ action } + ); MetadataTriggerHandler.permissionMap.clear(); @@ -628,8 +662,12 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserDoesNotHaveRequiredPermissionForSObject() { setting.Required_Permission__c = REQUIRED_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); - MetadataTriggerHandler.permissionMap = new Map{ REQUIRED_PERMISSION => false }; + MetadataTriggerHandler.selector = new FakeSelector( + new List{ action } + ); + MetadataTriggerHandler.permissionMap = new Map{ + REQUIRED_PERMISSION => false + }; handler.beforeInsert(handler.triggerNew); @@ -639,8 +677,12 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserDoesNotHaveRequiredPermissionForAction() { action.Required_Permission__c = REQUIRED_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); - MetadataTriggerHandler.permissionMap = new Map{ REQUIRED_PERMISSION => false }; + MetadataTriggerHandler.selector = new FakeSelector( + new List{ action } + ); + MetadataTriggerHandler.permissionMap = new Map{ + REQUIRED_PERMISSION => false + }; handler.beforeInsert(handler.triggerNew); @@ -650,8 +692,12 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserHasBypassPermissionForSObject() { setting.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); - MetadataTriggerHandler.permissionMap = new Map{ BYPASS_PERMISSION => true }; + MetadataTriggerHandler.selector = new FakeSelector( + new List{ action } + ); + MetadataTriggerHandler.permissionMap = new Map{ + BYPASS_PERMISSION => true + }; handler.beforeInsert(handler.triggerNew); @@ -661,8 +707,12 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserHasBypassPermissionForAction() { action.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); - MetadataTriggerHandler.permissionMap = new Map{ BYPASS_PERMISSION => true }; + MetadataTriggerHandler.selector = new FakeSelector( + new List{ action } + ); + MetadataTriggerHandler.permissionMap = new Map{ + BYPASS_PERMISSION => true + }; handler.beforeInsert(handler.triggerNew); @@ -685,7 +735,9 @@ private class MetadataTriggerHandlerTest { action.Allow_Flow_Recursion__c = false; MetadataTriggerHandler.bypass(TriggerActionFlow.class.getName()); - handler.beforeInsertActionMetadata = new List{ action }; + handler.beforeInsertActionMetadata = new List{ + action + }; try { handler.beforeInsert(handler.triggerNew); @@ -707,12 +759,18 @@ private class MetadataTriggerHandlerTest { } } public class TestBeforeUpdate implements TriggerAction.BeforeUpdate { - public void beforeUpdate(List triggerNew, List triggerOld) { + public void beforeUpdate( + List triggerNew, + List triggerOld + ) { MetadataTriggerHandlerTest.executed = true; } } public class TestAfterUpdate implements TriggerAction.AfterUpdate { - public void afterUpdate(List triggerNew, List triggerOld) { + public void afterUpdate( + List triggerNew, + List triggerOld + ) { MetadataTriggerHandlerTest.executed = true; } } @@ -746,4 +804,4 @@ private class MetadataTriggerHandlerTest { return this.results; } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerAction.cls b/trigger-actions-framework/main/default/classes/TriggerAction.cls index 9144621..59f2fea 100644 --- a/trigger-actions-framework/main/default/classes/TriggerAction.cls +++ b/trigger-actions-framework/main/default/classes/TriggerAction.cls @@ -132,4 +132,4 @@ public class TriggerAction { */ void execute(FinalizerHandler.Context context); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerAction.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls index eec95aa..accf2a9 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls @@ -31,4 +31,4 @@ public class TriggerActionConstants { TriggerActionConstants.FLOW_STRING, TriggerActionConstants.OBJECT_STRING }; -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls index 1818091..f4fdfce 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls @@ -104,7 +104,9 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction(getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE)), + invokeAction( + getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE) + ), triggerNew ); } @@ -156,7 +158,8 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio for (Integer i = 0; i < triggerNew.size(); i++) { sObject record = triggerNew[i]; if ( - TriggerBase.idToNumberOfTimesSeenAfterUpdate.get(record.id) == 1 || (allowRecursion == true) + TriggerBase.idToNumberOfTimesSeenAfterUpdate.get(record.id) == 1 || + (allowRecursion == true) ) { recordsNotYetProcessed.add(record); oldRecordsNotYetProcessed.add(triggerOld[i]); @@ -166,7 +169,9 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction(getInterviewInputs(recordsNotYetProcessed, oldRecordsNotYetProcessed)), + invokeAction( + getInterviewInputs(recordsNotYetProcessed, oldRecordsNotYetProcessed) + ), recordsNotYetProcessed ); } @@ -181,7 +186,12 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction(getInterviewInputs(triggerOld, TriggerActionConstants.RECORD_PRIOR_VARIABLE)), + invokeAction( + getInterviewInputs( + triggerOld, + TriggerActionConstants.RECORD_PRIOR_VARIABLE + ) + ), triggerOld ); } @@ -196,7 +206,12 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction(getInterviewInputs(triggerOld, TriggerActionConstants.RECORD_PRIOR_VARIABLE)), + invokeAction( + getInterviewInputs( + triggerOld, + TriggerActionConstants.RECORD_PRIOR_VARIABLE + ) + ), triggerOld ); } @@ -211,27 +226,40 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction(getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE)), + invokeAction( + getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE) + ), triggerNew ); } private Boolean flowIsBypassed() { if (String.isBlank(flowName)) { - throw new IllegalArgumentException(TriggerActionConstants.INVALID_FLOW_NAME); + throw new IllegalArgumentException( + TriggerActionConstants.INVALID_FLOW_NAME + ); } return TriggerActionFlow.isBypassed(flowName); } - private List invokeAction(List> inputs) { + private List invokeAction( + List> inputs + ) { return invocableAction.invokeAction(this.flowName, inputs); } - private void applyFlowValues(sObject stateBeforeFlow, sObject stateAfterFlow) { + private void applyFlowValues( + sObject stateBeforeFlow, + sObject stateAfterFlow + ) { Boolean hasBeenMutated = false; Set recordPopulatedFields = new Set(); - recordPopulatedFields.addAll(stateAfterFlow.getPopulatedFieldsAsMap().keySet()); - recordPopulatedFields.addAll(stateBeforeFlow.getPopulatedFieldsAsMap().keySet()); + recordPopulatedFields.addAll( + stateAfterFlow.getPopulatedFieldsAsMap().keySet() + ); + recordPopulatedFields.addAll( + stateBeforeFlow.getPopulatedFieldsAsMap().keySet() + ); for (String fieldName : recordPopulatedFields) { if (stateBeforeFlow.get(fieldName) != stateAfterFlow.get(fieldName)) { stateBeforeFlow.put(fieldName, stateAfterFlow.get(fieldName)); @@ -352,4 +380,4 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return action.invoke(); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls index ffa9674..824e100 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls @@ -55,11 +55,22 @@ public inherited sharing class TriggerActionFlowAddError { * @description This class represents a request to add an error to an sObject. */ public class Request { - @InvocableVariable(label='Record' description='Record to add the error to' required=true) + @InvocableVariable( + label='Record' + description='Record to add the error to' + required=true + ) public SObject record; - @InvocableVariable(label='Field Name' description='API name of corresponding field') + @InvocableVariable( + label='Field Name' + description='API name of corresponding field' + ) public String fieldName; - @InvocableVariable(label='Error Message' description='Error Message' required=true) + @InvocableVariable( + label='Error Message' + description='Error Message' + required=true + ) public String errorMessage; } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls index 2d5938a..870a4f7 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls @@ -31,8 +31,15 @@ private class TriggerActionFlowAddErrorTest { TriggerActionFlowAddError.addError(requests); - System.Assert.isTrue(account.hasErrors(), 'The Account should have an error'); - System.Assert.areEqual(1, account.getErrors().size(), 'There should only be one error'); + System.Assert.isTrue( + account.hasErrors(), + 'The Account should have an error' + ); + System.Assert.areEqual( + 1, + account.getErrors().size(), + 'There should only be one error' + ); System.Assert.areEqual( MY_STRING, account.getErrors()[0].getMessage(), @@ -50,12 +57,19 @@ private class TriggerActionFlowAddErrorTest { TriggerActionFlowAddError.addError(requests); - System.Assert.isTrue(account.hasErrors(), 'The Account should have an error'); - System.Assert.areEqual(1, account.getErrors().size(), 'There should only be one error'); + System.Assert.isTrue( + account.hasErrors(), + 'The Account should have an error' + ); + System.Assert.areEqual( + 1, + account.getErrors().size(), + 'There should only be one error' + ); System.Assert.areEqual( MY_STRING, account.getErrors()[0].getMessage(), 'The error should contain the message we are looking for' ); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls index ed1d30c..239deed 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls @@ -54,7 +54,11 @@ public inherited sharing class TriggerActionFlowBypass { required=true ) public String name; - @InvocableVariable(label='Bypass Type' description='Apex, Flow, or Object' required=true) + @InvocableVariable( + label='Bypass Type' + description='Apex, Flow, or Object' + required=true + ) public String bypassType; } @@ -71,4 +75,4 @@ public inherited sharing class TriggerActionFlowBypass { TriggerBase.bypass(name); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls index 7230976..0c94720 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls @@ -46,4 +46,4 @@ public inherited sharing abstract class TriggerActionFlowBypassProcessor { protected abstract void processApexBypasses(String requestType); protected abstract void processFlowBypasses(String requestType); protected abstract void processObjectBypasses(String requestType); -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls index 89fa148..2a7f250 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls @@ -30,7 +30,10 @@ private class TriggerActionFlowBypassTest { TriggerActionFlowBypass.bypass(requests); - System.Assert.isTrue(TriggerBase.isBypassed(MY_STRING), 'The Object should be bypassed'); + System.Assert.isTrue( + TriggerBase.isBypassed(MY_STRING), + 'The Object should be bypassed' + ); } @IsTest @@ -55,7 +58,10 @@ private class TriggerActionFlowBypassTest { TriggerActionFlowBypass.bypass(requests); - System.Assert.isTrue(TriggerActionFlow.isBypassed(MY_STRING), 'The Flow should be bypassed'); + System.Assert.isTrue( + TriggerActionFlow.isBypassed(MY_STRING), + 'The Flow should be bypassed' + ); } @IsTest @@ -86,4 +92,4 @@ private class TriggerActionFlowBypassTest { 'The exeption should contain the message we are looking for' ); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls index 2869b6e..45efc9b 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls @@ -66,4 +66,4 @@ public with sharing class TriggerActionFlowChangeEvent extends TriggerActionFlow throw new IllegalArgumentException(NOT_CHANGE_EVENT_ERROR); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls index b8c5de8..4c3068a 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls @@ -95,4 +95,4 @@ private with sharing class TriggerActionFlowChangeEventTest { 'The value for "header" is constructed improperly' ); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls index 64fe2bf..a4aa158 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls @@ -60,4 +60,4 @@ public inherited sharing class TriggerActionFlowClearAllBypasses { TriggerBase.clearAllBypasses(); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls index 76300d9..503ff66 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls @@ -27,7 +27,10 @@ private class TriggerActionFlowClearAllBypassesTest { new List{ TriggerActionConstants.OBJECT_STRING } ); - System.Assert.isFalse(TriggerBase.isBypassed(MY_STRING), 'The Object should not be bypassed'); + System.Assert.isFalse( + TriggerBase.isBypassed(MY_STRING), + 'The Object should not be bypassed' + ); } @IsTest @@ -63,7 +66,9 @@ private class TriggerActionFlowClearAllBypassesTest { Exception myException; try { - TriggerActionFlowClearAllBypasses.clearAllBypasses(new List{ MY_STRING }); + TriggerActionFlowClearAllBypasses.clearAllBypasses( + new List{ MY_STRING } + ); } catch (Exception e) { myException = e; } @@ -84,4 +89,4 @@ private class TriggerActionFlowClearAllBypassesTest { 'The exeption should contain the message we are looking for' ); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls index 10b596c..6c9dd81 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls @@ -27,7 +27,7 @@ * * The `clearBypass` method will clear the bypass for the specified objects, Apex actions, or Flow actions. */ -@SuppressWarnings('PMD.CognitiveComplexity') +@SuppressWarnings('PMD.ApexDoc, PMD.CognitiveComplexity') public inherited sharing class TriggerActionFlowClearBypass { /** * @description This method clears the bypass for the specified objects, Apex actions, or Flow actions. @@ -62,7 +62,11 @@ public inherited sharing class TriggerActionFlowClearBypass { required=true ) public String name; - @InvocableVariable(label='Bypass Type' description='Apex, Flow, or Object' required=true) + @InvocableVariable( + label='Bypass Type' + description='Apex, Flow, or Object' + required=true + ) public String bypassType; } @@ -87,4 +91,4 @@ public inherited sharing class TriggerActionFlowClearBypass { TriggerBase.clearBypass(name); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls index 1894cfa..aec67e1 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls @@ -31,7 +31,10 @@ private class TriggerActionFlowClearBypassTest { TriggerActionFlowClearBypass.clearBypass(requests); - System.Assert.isFalse(TriggerBase.isBypassed(MY_STRING), 'The Object should not be bypassed'); + System.Assert.isFalse( + TriggerBase.isBypassed(MY_STRING), + 'The Object should not be bypassed' + ); } @IsTest @@ -92,4 +95,4 @@ private class TriggerActionFlowClearBypassTest { 'The exeption should contain the message we are looking for' ); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls index 3d20019..1b90586 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls @@ -95,4 +95,4 @@ public inherited sharing class TriggerActionFlowIsBypassed { this.hasBeenBypassed = TriggerBase.isBypassed(name); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls index 73aedde..8a0bd6d 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls @@ -30,7 +30,11 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); + System.Assert.areEqual( + 1, + isBypassed.size(), + 'We should only have one result for our request' + ); System.Assert.areEqual( TriggerBase.isBypassed(MY_STRING), isBypassed[0], @@ -46,7 +50,11 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); + System.Assert.areEqual( + 1, + isBypassed.size(), + 'We should only have one result for our request' + ); System.Assert.areEqual( MetadataTriggerHandler.isBypassed(MY_STRING), isBypassed[0], @@ -62,7 +70,11 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); + System.Assert.areEqual( + 1, + isBypassed.size(), + 'We should only have one result for our request' + ); System.Assert.areEqual( TriggerActionFlow.isBypassed(MY_STRING), isBypassed[0], @@ -99,4 +111,4 @@ private class TriggerActionFlowIsBypassedTest { 'The exeption should contain the message we are looking for' ); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls index 707b4c0..b9d9a0f 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls @@ -39,7 +39,10 @@ private class TriggerActionFlowTest { Name = MY_ACCOUNT, Id = TriggerTestUtility.getFakeId(Schema.Account.SObjectType) ); - private static Account oldAccount = new Account(Name = OLD_NAME, Id = myAccount.Id); + private static Account oldAccount = new Account( + Name = OLD_NAME, + Id = myAccount.Id + ); private static Account myAccountAfterFlow = myAccount.clone(true); private static List triggerNew = new List{ myAccount }; private static List triggerOld = new List{ oldAccount }; @@ -49,7 +52,9 @@ private class TriggerActionFlowTest { private static Invocable.Action.Result successResult = new InvocableActionResultBuilder() .setSuccess(true) .setOutputParameters( - new Map{ TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow } + new Map{ + TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow + } ) .build(); @@ -130,14 +135,22 @@ private class TriggerActionFlowTest { System.Assert.areEqual(FOO, myAccount.Name, NAME_SET_FROM_FLOW); System.Assert.areEqual(true, myAccount.hasErrors(), ERROR_SHOULD_BE_ADDED); System.Assert.areEqual(1, myAccount.getErrors().size(), ONE_ERROR); - System.Assert.areEqual(TEST, myAccount.getErrors()[0].getMessage(), ERROR_MESSAGE_SHOULD_MATCH); + System.Assert.areEqual( + TEST, + myAccount.getErrors()[0].getMessage(), + ERROR_MESSAGE_SHOULD_MATCH + ); } @IsTest private static void afterInsertShouldSucceed() { actionFlow.afterInsert(triggerNew); - System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); + System.Assert.areEqual( + false, + myAccount.hasErrors(), + ERROR_SHOULD_NOT_BE_ADDED + ); } @IsTest @@ -147,7 +160,11 @@ private class TriggerActionFlowTest { System.Assert.areEqual(FOO, myAccount.Name, NAME_SET_FROM_FLOW); System.Assert.areEqual(true, myAccount.hasErrors(), ERROR_SHOULD_BE_ADDED); System.Assert.areEqual(1, myAccount.getErrors().size(), ONE_ERROR); - System.Assert.areEqual(TEST, myAccount.getErrors()[0].getMessage(), ERROR_MESSAGE_SHOULD_MATCH); + System.Assert.areEqual( + TEST, + myAccount.getErrors()[0].getMessage(), + ERROR_MESSAGE_SHOULD_MATCH + ); } @IsTest @@ -164,7 +181,11 @@ private class TriggerActionFlowTest { private static void afterUpdateShouldSucceed() { actionFlow.afterUpdate(triggerNew, triggerOld); - System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); + System.Assert.areEqual( + false, + myAccount.hasErrors(), + ERROR_SHOULD_NOT_BE_ADDED + ); } @IsTest @@ -174,28 +195,44 @@ private class TriggerActionFlowTest { actionFlow.afterUpdate(triggerNew, triggerOld); - System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); + System.Assert.areEqual( + false, + myAccount.hasErrors(), + ERROR_SHOULD_NOT_BE_ADDED + ); } @IsTest private static void beforeDeleteShouldSucceed() { actionFlow.beforeDelete(triggerOld); - System.Assert.areEqual(false, oldAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); + System.Assert.areEqual( + false, + oldAccount.hasErrors(), + ERROR_SHOULD_NOT_BE_ADDED + ); } @IsTest private static void afterDeleteShouldSucceed() { actionFlow.afterDelete(triggerOld); - System.Assert.areEqual(false, oldAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); + System.Assert.areEqual( + false, + oldAccount.hasErrors(), + ERROR_SHOULD_NOT_BE_ADDED + ); } @IsTest private static void afterUndeleteShouldSucceed() { actionFlow.afterUndelete(triggerOld); - System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); + System.Assert.areEqual( + false, + myAccount.hasErrors(), + ERROR_SHOULD_NOT_BE_ADDED + ); } @IsTest @@ -212,18 +249,24 @@ private class TriggerActionFlowTest { System.Assert.areEqual( true, - myException.getMessage().contains(TriggerActionFlow.RECORD_VARIABLE_NOT_FOUND_ERROR), + myException.getMessage() + .contains(TriggerActionFlow.RECORD_VARIABLE_NOT_FOUND_ERROR), EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE ); } @IsTest private static void noRecordMutationsShouldSucceed() { - successResult.getOutputParameters().put(TriggerActionConstants.RECORD_VARIABLE, myAccount); + successResult.getOutputParameters() + .put(TriggerActionConstants.RECORD_VARIABLE, myAccount); actionFlow.beforeInsert(triggerNew); - System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); + System.Assert.areEqual( + false, + myAccount.hasErrors(), + ERROR_SHOULD_NOT_BE_ADDED + ); } @IsTest @@ -245,11 +288,16 @@ private class TriggerActionFlowTest { new InvocableActionResultBuilder() .setSuccess(false) .setOutputParameters( - new Map{ TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow } + new Map{ + TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow + } ) .setErrors( new List{ - new InvocableActionErrorBuilder().setCode(TEST).setMessage(FOO).build() + new InvocableActionErrorBuilder() + .setCode(TEST) + .setMessage(FOO) + .build() } ) .build() @@ -314,10 +362,17 @@ private class TriggerActionFlowTest { @IsTest private static void invokeFlowShouldReturnUnsuccessfulResponseWithBogusFlowName() { List results = new TriggerActionFlow.InvocableAction() - .invokeAction(BOGUS, new List>{ new Map() }); + .invokeAction( + BOGUS, + new List>{ new Map() } + ); System.Assert.areEqual(1, results.size(), ONE_ERROR); - System.Assert.areEqual(false, results[0].isSuccess(), 'It should have failed with bogus name'); + System.Assert.areEqual( + false, + results[0].isSuccess(), + 'It should have failed with bogus name' + ); } private virtual class FakeInvocableAction extends TriggerActionFlow.InvocableAction { @@ -339,7 +394,9 @@ private class TriggerActionFlowTest { private Invocable.Action action; private List errors; - public InvocableActionResultBuilder setOutputParameters(Map outputParameters) { + public InvocableActionResultBuilder setOutputParameters( + Map outputParameters + ) { this.outputParameters = outputParameters; return this; } @@ -351,7 +408,9 @@ private class TriggerActionFlowTest { this.action = action; return this; } - public InvocableActionResultBuilder setErrors(List errors) { + public InvocableActionResultBuilder setErrors( + List errors + ) { this.errors = errors; return this; } @@ -388,9 +447,11 @@ private class TriggerActionFlowTest { public Invocable.Action.error build() { return (Invocable.Action.error) JSON.deserialize( - JSON.serialize(new Map{ 'code' => code, 'message' => message }), + JSON.serialize( + new Map{ 'code' => code, 'message' => message } + ), Invocable.Action.error.class ); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerBase.cls b/trigger-actions-framework/main/default/classes/TriggerBase.cls index dd46e62..61389ec 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBase.cls +++ b/trigger-actions-framework/main/default/classes/TriggerBase.cls @@ -192,13 +192,15 @@ public inherited sharing virtual class TriggerBase { this instanceof TriggerAction.BeforeUpdate ) { this.incrementUpdateCounts(this.context, this.triggerNew); - ((TriggerAction.BeforeUpdate) this).beforeUpdate(this.triggerNew, this.triggerOld); + ((TriggerAction.BeforeUpdate) this) + .beforeUpdate(this.triggerNew, this.triggerOld); } else if ( this.context == System.TriggerOperation.AFTER_UPDATE && this instanceof TriggerAction.AfterUpdate ) { this.incrementUpdateCounts(this.context, this.triggerNew); - ((TriggerAction.AfterUpdate) this).afterUpdate(this.triggerNew, this.triggerOld); + ((TriggerAction.AfterUpdate) this) + .afterUpdate(this.triggerNew, this.triggerOld); } else if ( this.context == System.TriggerOperation.BEFORE_DELETE && this instanceof TriggerAction.BeforeDelete @@ -250,7 +252,9 @@ public inherited sharing virtual class TriggerBase { List records ) { for (SObject obj : records) { - Map idToUpdateCount = CONTEXT_TO_UPDATE_COUNT.get(triggerContext); + Map idToUpdateCount = CONTEXT_TO_UPDATE_COUNT.get( + triggerContext + ); Integer updateCount = idToUpdateCount.get(obj.Id); if (updateCount == null) { updateCount = 0; @@ -309,7 +313,10 @@ public inherited sharing virtual class TriggerBase { protected String sObjectName { get { if (sObjectName == null) { - sObjectName = this.sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getName(); + sObjectName = this.sObjectType.getDescribe( + SObjectDescribeOptions.DEFERRED + ) + .getName(); } return sObjectName; } @@ -351,7 +358,9 @@ public inherited sharing virtual class TriggerBase { private Integer triggerSize { get { - return triggerNew != null ? triggerNew.size() : triggerOld != null ? triggerOld.size() : 0; + return triggerNew != null + ? triggerNew.size() + : triggerOld != null ? triggerOld.size() : 0; } } @@ -419,4 +428,4 @@ public inherited sharing virtual class TriggerBase { @TestVisible private class EmptyStackException extends Exception { } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerBase.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls index 0687010..54e65f9 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls @@ -70,8 +70,16 @@ private class TriggerBaseTest { base.triggerNew = null; base.triggerOld = null; - System.Assert.areEqual(null, base.triggerNew, 'triggerNew should match Trigger.new'); - System.Assert.areEqual(null, base.triggerOld, 'triggerOld should match Trigger.old'); + System.Assert.areEqual( + null, + base.triggerNew, + 'triggerNew should match Trigger.new' + ); + System.Assert.areEqual( + null, + base.triggerOld, + 'triggerOld should match Trigger.old' + ); } @IsTest @@ -174,7 +182,11 @@ private class TriggerBaseTest { myException = e; } - System.Assert.areNotEqual(null, myException, 'An exception should be thrown'); + System.Assert.areNotEqual( + null, + myException, + 'An exception should be thrown' + ); System.Assert.areEqual( TriggerBase.HANDLER_OUTSIDE_TRIGGER_MESSAGE, myException.getMessage(), @@ -264,7 +276,10 @@ private class TriggerBaseTest { private static void isBypassedShouldSucceed() { TriggerBase.bypass(ACCOUNT); - System.Assert.isTrue(TriggerBase.isBypassed(ACCOUNT), BYPASSES_SHOULD_BE_CONFIGURED_CORRECTLY); + System.Assert.isTrue( + TriggerBase.isBypassed(ACCOUNT), + BYPASSES_SHOULD_BE_CONFIGURED_CORRECTLY + ); } @IsTest @@ -284,7 +299,11 @@ private class TriggerBaseTest { private static void offsetRowsShouldWork() { TriggerBase.offsetExistingDmlRows(); - System.Assert.areEqual(0, TriggerBase.existingDmlRowsOffset, 'Offset is not working properly'); + System.Assert.areEqual( + 0, + TriggerBase.existingDmlRowsOffset, + 'Offset is not working properly' + ); } @IsTest @@ -324,7 +343,10 @@ private class TriggerBaseTest { stack.push(FIRST); stack.pop(); - System.Assert.isTrue(stack.isEmpty(), 'The stack is empty but unable to identify as such'); + System.Assert.isTrue( + stack.isEmpty(), + 'The stack is empty but unable to identify as such' + ); } @IsTest @@ -365,7 +387,11 @@ private class TriggerBaseTest { stack.push(SECOND); stack.push(THIRD); - System.Assert.areEqual(THIRD, stack.peek(), 'The last element in the stack is not peeked'); + System.Assert.areEqual( + THIRD, + stack.peek(), + 'The last element in the stack is not peeked' + ); } @IsTest @@ -375,7 +401,11 @@ private class TriggerBaseTest { stack.push(SECOND); stack.push(THIRD); - System.Assert.areEqual(3, stack.depth(), 'The stack is not properly calculating its depth'); + System.Assert.areEqual( + 3, + stack.depth(), + 'The stack is not properly calculating its depth' + ); } @IsTest @@ -422,10 +452,16 @@ private class TriggerBaseTest { public void afterInsert(List triggerNew) { this.executed = true; } - public void beforeUpdate(List triggerNew, List triggerOld) { + public void beforeUpdate( + List triggerNew, + List triggerOld + ) { this.executed = true; } - public void afterUpdate(List triggerNew, List triggerOld) { + public void afterUpdate( + List triggerNew, + List triggerOld + ) { this.executed = true; } public void beforeDelete(List triggerOld) { @@ -448,4 +484,4 @@ private class TriggerBaseTest { return super.getDmlRows(); } } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerRecord.cls b/trigger-actions-framework/main/default/classes/TriggerRecord.cls index 5733709..fff6e45 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecord.cls +++ b/trigger-actions-framework/main/default/classes/TriggerRecord.cls @@ -28,4 +28,4 @@ global abstract class TriggerRecord { * @description The previous version of the SObject that triggered the current execution context. */ global SObject oldSobject; -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerRecord.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls index a8aca7b..f111235 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls @@ -34,4 +34,4 @@ private class TriggerRecordTest { private class AccountTriggerRecord extends TriggerRecord { } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls index 7992d0c..1353a32 100644 --- a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls +++ b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls @@ -35,8 +35,9 @@ public class TriggerTestUtility { */ public static Id getFakeId(Schema.SObjectType sObjectType) { String result = String.valueOf(myNumber++); - return (Id) (sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getKeyPrefix() + + return (Id) (sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED) + .getKeyPrefix() + '0'.repeat(12 - result.length()) + result); } -} \ No newline at end of file +} diff --git a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml index 5f399c3..835ede4 100644 --- a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml +++ b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls-meta.xml @@ -2,4 +2,4 @@ 63.0 Active - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml b/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml index 8d7e554..e87be1f 100644 --- a/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml +++ b/trigger-actions-framework/main/default/layouts/DML_Finalizer__mdt-DML Finalizer Layout.layout-meta.xml @@ -82,9 +82,9 @@ true false - - - + + + false @@ -98,4 +98,4 @@ 0 Default - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml index c78a0b1..94a8d22 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -11,4 +11,4 @@ true Text true - + \ No newline at end of file diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml index ef423e0..ee8fe5e 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/Trigger_Action__mdt.object-meta.xml @@ -1,4 +1,4 @@ - + Trigger Actions diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml index ac2f9f6..8daca5c 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml @@ -1,7 +1,8 @@ - + After_Delete__c - Enter the name of the sObject you want to have this action execute on during the after delete context + Enter the name of the sObject you want to have this action execute on during the after delete context false SubscriberControlled Enter the name of the sObject you want to have this action execute on during the after delete context diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml index b508c32..2adfa11 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Insert__c.field-meta.xml @@ -1,9 +1,10 @@ - + After_Insert__c - Enter the name of the sObject you want to have this action execute on during the after insert context + Enter the name of the sObject you want to have this action execute on during the after insert context false - SubscriberControlled + DeveloperControlled Enter the name of the sObject you want to have this action execute on during the after insert context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml index 564833d..5f1dd94 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml @@ -1,7 +1,8 @@ - + After_Undelete__c - Enter the name of the sObject you want to have this action execute on during the after undelete context + Enter the name of the sObject you want to have this action execute on during the after undelete context false SubscriberControlled Enter the name of the sObject you want to have this action execute on during the after undelete context diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml index 6e16982..9c84901 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml @@ -1,7 +1,8 @@ - + After_Update__c - Enter the name of the sObject you want to have this action execute on during the after update context + Enter the name of the sObject you want to have this action execute on during the after update context false SubscriberControlled Enter the name of the sObject you want to have this action execute on during the after update context diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml index 5ec9eea..ebb90e4 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml @@ -1,8 +1,9 @@ - + Allow_Flow_Recursion__c false - Check this box to allow the flow to execute recursively + Check this box to allow the flow to execute recursively false SubscriberControlled Check this box to allow the flow to execute recursively diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml index 9a585d0..7bd6138 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -1,7 +1,8 @@ - + Apex_Class_Name__c - Enter the name of the Apex Class which defines the action to be taken + Enter the name of the Apex Class which defines the action to be taken false SubscriberControlled Enter the name of the Apex Class which defines the action to be taken diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml index 574092a..3720be3 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml @@ -1,7 +1,8 @@ - + Before_Delete__c - Enter the name of the sObject you want to have this action execute on during the before delete context + Enter the name of the sObject you want to have this action execute on during the before delete context false SubscriberControlled Enter the name of the sObject you want to have this action execute on during the before delete context diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml index 46679a0..aee0760 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml @@ -1,7 +1,8 @@ - + Before_Insert__c - Enter the name of the sObject you want to have this action execute on during the before insert context + Enter the name of the sObject you want to have this action execute on during the before insert context false SubscriberControlled Enter the name of the sObject you want to have this action execute on during the before insert context diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml index 1d0fdf5..390eb83 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml @@ -1,7 +1,8 @@ - + Before_Update__c - Enter the name of the sObject you want to have this action execute on during the before update context + Enter the name of the sObject you want to have this action execute on during the before update context false SubscriberControlled Enter the name of the sObject you want to have this action execute on during the before update context diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml index a99bec8..e160c88 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -1,8 +1,9 @@ - + Bypass_Execution__c false - Set this to true to bypass this Trigger Action from being called + Set this to true to bypass this Trigger Action from being called false SubscriberControlled Set this to true to bypass this Trigger Action from being called diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml index e1299b3..1c12e78 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -1,7 +1,8 @@ - + Bypass_Permission__c - 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. + 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. false SubscriberControlled 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. diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml index ea207c0..367402d 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml @@ -1,4 +1,4 @@ - + Description__c false diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml index 2483ab8..1f092ae 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml @@ -1,7 +1,8 @@ - + Flow_Name__c - Enter the API name of the flow you would like to execute. + Enter the API name of the flow you would like to execute. false SubscriberControlled Enter the API name of the flow you would like to execute. diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml index 6d551e7..2b9b8ed 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml @@ -1,4 +1,4 @@ - + Order__c false diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml index 4939ecb..fea5e84 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml @@ -1,7 +1,8 @@ - + Required_Permission__c - 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. + 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. false SubscriberControlled 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. diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml index 88dfb3f..1f8bbc0 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Description_is_Required.validationRule-meta.xml @@ -1,9 +1,11 @@ - + Description_is_Required true - You must enter a description for this Trigger Action. + You must enter a description for this Trigger Action. ISBLANK(Description__c) Description__c - You must enter a description for this Trigger Action. + You must enter a description for this Trigger Action. diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml index 99efc72..f986af2 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Must_Choose_A_Context.validationRule-meta.xml @@ -1,8 +1,9 @@ - + Must_Choose_A_Context false - Throws an error if the user does not choose at least one context + Throws an error if the user does not choose at least one context ISBLANK(Before_Insert__c) && ISBLANK(After_Insert__c) diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml index 29c5c4a..98fdf1a 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Only_One_Context.validationRule-meta.xml @@ -1,8 +1,9 @@ - + Only_One_Context true - Throws an error if the user selects more than one context. + Throws an error if the user selects more than one context. OR( NOT(ISBLANK(Before_Insert__c)) && OR( diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml index ddfbbae..9180b29 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/validationRules/Recursion_Only_For_Flows.validationRule-meta.xml @@ -1,8 +1,11 @@ - + Recursion_Only_For_Flows true - Throws an error if the "Allow Flow Recursion" checkbox is checked without a "Flow Name". - Allow_Flow_Recursion__c == true && ISBLANK( Flow_Name__c ) - You can only mark "Allow Flow Recursion" checkbox as "True" when you have a value for "Flow Name". + Throws an error if the "Allow Flow Recursion" checkbox is checked without a "Flow Name". + Allow_Flow_Recursion__c == true && ISBLANK( Flow_Name__c ) + You can only mark "Allow Flow Recursion" checkbox as "True" when you have a value for "Flow Name". diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml index dd5d4cf..67907b0 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -1,8 +1,9 @@ - + Bypass_Execution__c false - Set this to true to bypass all Trigger Actions from being called on this sObject + Set this to true to bypass all Trigger Actions from being called on this sObject false SubscriberControlled Set this to true to bypass all Trigger Actions from being called on this sObject diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml index e1299b3..1c12e78 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -1,7 +1,8 @@ - + Bypass_Permission__c - 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. + 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. false SubscriberControlled 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. diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml index 865b178..aafb161 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml @@ -1,7 +1,8 @@ - + Object_API_Name__c - Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. + Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. false SubscriberControlled Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml index a0f8bdb..8e3098f 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml @@ -1,4 +1,4 @@ - + Object_Namespace__c Enter the namespace object for this trigger. diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml index a103632..3447fbd 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml @@ -1,7 +1,8 @@ - + Required_Permission__c - 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. + 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. false SubscriberControlled 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. diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml index fd5ff58..4de350a 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/sObject_Trigger_Setting__mdt.object-meta.xml @@ -1,4 +1,4 @@ - + sObject Trigger Settings From cf5eb0fd14572a18b99bf2dc80bae7696ba7f873 Mon Sep 17 00:00:00 2001 From: David Schach Date: Thu, 20 Mar 2025 14:30:51 -0700 Subject: [PATCH 08/16] revert field control --- .../DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml | 2 +- .../fields/Bypass_Execution__c.field-meta.xml | 2 +- .../fields/Bypass_Permission__c.field-meta.xml | 2 +- .../objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml | 2 +- .../fields/Required_Permission__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/After_Update__c.field-meta.xml | 2 +- .../fields/Allow_Flow_Recursion__c.field-meta.xml | 2 +- .../fields/Apex_Class_Name__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml | 2 +- .../fields/Bypass_Execution__c.field-meta.xml | 2 +- .../fields/Bypass_Permission__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Description__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml | 2 +- .../Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml | 2 +- .../objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml | 2 +- .../fields/Required_Permission__c.field-meta.xml | 2 +- .../fields/Bypass_Execution__c.field-meta.xml | 2 +- .../fields/Bypass_Permission__c.field-meta.xml | 2 +- .../fields/Object_API_Name__c.field-meta.xml | 2 +- .../fields/Object_Namespace__c.field-meta.xml | 2 +- .../fields/Required_Permission__c.field-meta.xml | 2 +- .../fields/TriggerRecord_Class_Name__c.field-meta.xml | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml index 94a8d22..54647c1 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -4,7 +4,7 @@ false Enter the name of the Apex Class which defines the action to be taken false - SubscriberControlled + DeveloperControlled Enter the name of the Apex Class which defines the action to be taken 255 diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml index a99bec8..d2229b9 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -4,7 +4,7 @@ false Set this to true to bypass this Trigger Action from being called false - SubscriberControlled + DeveloperControlled Set this to true to bypass this Trigger Action from being called Checkbox diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml index e1299b3..f16b52e 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Bypass_Permission__c 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. false - SubscriberControlled + DeveloperControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml index 6d551e7..77370ed 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Order__c.field-meta.xml @@ -2,7 +2,7 @@ Order__c false - SubscriberControlled + DeveloperControlled 18 true diff --git a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml index 4939ecb..cb1515a 100644 --- a/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/DML_Finalizer__mdt/fields/Required_Permission__c.field-meta.xml @@ -3,7 +3,7 @@ Required_Permission__c 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. false - SubscriberControlled + DeveloperControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml index 8daca5c..11fd070 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Delete__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the name of the sObject you want to have this action execute on during the after delete context false - SubscriberControlled + DeveloperControlled Enter the name of the sObject you want to have this action execute on during the after delete context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml index 5f1dd94..30a40a1 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Undelete__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the name of the sObject you want to have this action execute on during the after undelete context false - SubscriberControlled + DeveloperControlled Enter the name of the sObject you want to have this action execute on during the after undelete context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml index 9c84901..2b899ad 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/After_Update__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the name of the sObject you want to have this action execute on during the after update context false - SubscriberControlled + DeveloperControlled Enter the name of the sObject you want to have this action execute on during the after update context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml index ebb90e4..9c53675 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Allow_Flow_Recursion__c.field-meta.xml @@ -5,7 +5,7 @@ Check this box to allow the flow to execute recursively false - SubscriberControlled + DeveloperControlled Check this box to allow the flow to execute recursively Checkbox diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml index 7bd6138..d242a5f 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Apex_Class_Name__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the name of the Apex Class which defines the action to be taken false - SubscriberControlled + DeveloperControlled Enter the name of the Apex Class which defines the action to be taken 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml index 3720be3..fa95b94 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Delete__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the name of the sObject you want to have this action execute on during the before delete context false - SubscriberControlled + DeveloperControlled Enter the name of the sObject you want to have this action execute on during the before delete context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml index aee0760..3d5d94b 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Insert__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the name of the sObject you want to have this action execute on during the before insert context false - SubscriberControlled + DeveloperControlled Enter the name of the sObject you want to have this action execute on during the before insert context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml index 390eb83..8bcc800 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Before_Update__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the name of the sObject you want to have this action execute on during the before update context false - SubscriberControlled + DeveloperControlled Enter the name of the sObject you want to have this action execute on during the before update context sObject_Trigger_Setting__mdt diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml index e160c88..3e6ed47 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -5,7 +5,7 @@ Set this to true to bypass this Trigger Action from being called false - SubscriberControlled + DeveloperControlled Set this to true to bypass this Trigger Action from being called Checkbox diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml index 1c12e78..e7dd391 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -4,7 +4,7 @@ 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. false - SubscriberControlled + DeveloperControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml index 367402d..fd4a327 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Description__c.field-meta.xml @@ -2,7 +2,7 @@ Description__c false - SubscriberControlled + DeveloperControlled 32768 LongTextArea diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml index 73a7126..4801ec7 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml @@ -3,7 +3,7 @@ Entry_Criteria__c Formula which if evaluated to true for a given record during trigger processing, then this trigger action will be processed for that record. false - SubscriberControlled + DeveloperControlled Formula which if evaluated to true for a given record during trigger processing, then this trigger action will be processed for that record. 32768 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml index 1f092ae..9ee380a 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Flow_Name__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the API name of the flow you would like to execute. false - SubscriberControlled + DeveloperControlled Enter the API name of the flow you would like to execute. 255 diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml index 2b9b8ed..428e5f1 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Order__c.field-meta.xml @@ -2,7 +2,7 @@ Order__c false - SubscriberControlled + DeveloperControlled 18 true diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml index fea5e84..5b0e9c1 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Required_Permission__c.field-meta.xml @@ -4,7 +4,7 @@ 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. false - SubscriberControlled + DeveloperControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml index 67907b0..351e229 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Execution__c.field-meta.xml @@ -5,7 +5,7 @@ Set this to true to bypass all Trigger Actions from being called on this sObject false - SubscriberControlled + DeveloperControlled Set this to true to bypass all Trigger Actions from being called on this sObject Checkbox diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml index 1c12e78..e7dd391 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Bypass_Permission__c.field-meta.xml @@ -4,7 +4,7 @@ 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. false - SubscriberControlled + DeveloperControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml index aafb161..81ff96a 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_API_Name__c.field-meta.xml @@ -4,7 +4,7 @@ Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. false - SubscriberControlled + DeveloperControlled Enter the API Name of the object for this trigger. If this object is part of a managed package, do not include the prefix. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml index 8e3098f..b0f8e89 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Object_Namespace__c.field-meta.xml @@ -3,7 +3,7 @@ Object_Namespace__c Enter the namespace object for this trigger. false - SubscriberControlled + DeveloperControlled Enter the namespace object for this trigger. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml index 3447fbd..845b950 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/Required_Permission__c.field-meta.xml @@ -4,7 +4,7 @@ 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. false - SubscriberControlled + DeveloperControlled 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. 255 diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml index 86b83d2..9421bae 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml @@ -5,7 +5,7 @@ and `recordPrior`. Both of these variables need to match the SObject type for this SObject Trigger Setting record. false - SubscriberControlled + DeveloperControlled 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. From 85907273c31d01db8d1d9509e4affe27426ba3d6 Mon Sep 17 00:00:00 2001 From: David Schach Date: Thu, 20 Mar 2025 15:55:01 -0700 Subject: [PATCH 09/16] remove some metadata --- ...ing__mdt-sObject Trigger Setting Layout.layout-meta.xml | 7 ------- .../fields/Entry_Criteria__c.field-meta.xml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml b/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml index d152de8..e38ccd9 100644 --- a/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml +++ b/trigger-actions-framework/main/default/layouts/sObject_Trigger_Setting__mdt-sObject Trigger Setting Layout.layout-meta.xml @@ -96,7 +96,6 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c - Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.Before_Insert__c @@ -108,7 +107,6 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c - Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Insert__c @@ -120,7 +118,6 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c - Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.Before_Update__c @@ -132,7 +129,6 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c - Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Update__c @@ -144,7 +140,6 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c - Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.Before_Delete__c @@ -156,7 +151,6 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c - Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Delete__c @@ -168,7 +162,6 @@ Apex_Class_Name__c Flow_Name__c Entry_Criteria__c - Bypass_Execution__c Description__c Order__c Trigger_Action__mdt.After_Undelete__c diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml index 4801ec7..73a7126 100644 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/fields/Entry_Criteria__c.field-meta.xml @@ -3,7 +3,7 @@ Entry_Criteria__c Formula which if evaluated to true for a given record during trigger processing, then this trigger action will be processed for that record. false - DeveloperControlled + SubscriberControlled Formula which if evaluated to true for a given record during trigger processing, then this trigger action will be processed for that record. 32768 From 75d86c211f6fa3397fc1a20fa954c0d63753acca Mon Sep 17 00:00:00 2001 From: David Schach Date: Thu, 20 Mar 2025 15:56:06 -0700 Subject: [PATCH 10/16] fix husky in package.json --- package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/package.json b/package.json index a2a0ecf..5e29681 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,6 @@ "prettier": "3.5.3", "prettier-plugin-apex": "2.2.5" }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, "lint-staged": { "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ "prettier --write" From d866ce7e7e6d838049d3f226b9a96f4a8d324556 Mon Sep 17 00:00:00 2001 From: David Schach Date: Thu, 20 Mar 2025 15:58:20 -0700 Subject: [PATCH 11/16] prettier Apex classes --- .prettierrc | 72 +++++++++- package.json | 2 - .../main/default/classes/FinalizerHandler.cls | 24 +--- .../default/classes/FinalizerHandlerTest.cls | 22 +-- .../default/classes/FlowChangeEventHeader.cls | 2 +- .../classes/FlowChangeEventHeaderTest.cls | 11 +- .../main/default/classes/FormulaFilter.cls | 33 ++--- .../default/classes/FormulaFilterTest.cls | 92 +++--------- .../classes/MetadataTriggerHandler.cls | 131 +++++------------- .../classes/MetadataTriggerHandlerTest.cls | 116 ++++------------ .../main/default/classes/TriggerAction.cls | 2 +- .../classes/TriggerActionConstants.cls | 2 +- .../default/classes/TriggerActionFlow.cls | 52 ++----- .../classes/TriggerActionFlowAddError.cls | 19 +-- .../classes/TriggerActionFlowAddErrorTest.cls | 24 +--- .../classes/TriggerActionFlowBypass.cls | 8 +- .../TriggerActionFlowBypassProcessor.cls | 2 +- .../classes/TriggerActionFlowBypassTest.cls | 12 +- .../classes/TriggerActionFlowChangeEvent.cls | 2 +- .../TriggerActionFlowChangeEventTest.cls | 2 +- .../TriggerActionFlowClearAllBypasses.cls | 2 +- .../TriggerActionFlowClearAllBypassesTest.cls | 11 +- .../classes/TriggerActionFlowClearBypass.cls | 8 +- .../TriggerActionFlowClearBypassTest.cls | 7 +- .../classes/TriggerActionFlowIsBypassed.cls | 2 +- .../TriggerActionFlowIsBypassedTest.cls | 20 +-- .../default/classes/TriggerActionFlowTest.cls | 103 +++----------- .../main/default/classes/TriggerBase.cls | 21 +-- .../main/default/classes/TriggerBaseTest.cls | 58 ++------ .../main/default/classes/TriggerRecord.cls | 2 +- .../default/classes/TriggerRecordTest.cls | 2 +- .../default/classes/TriggerTestUtility.cls | 5 +- 32 files changed, 257 insertions(+), 614 deletions(-) diff --git a/.prettierrc b/.prettierrc index 50f14e3..08737ee 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,15 +1,81 @@ { - "plugins": ["prettier-plugin-apex"], + "arrowParens": "avoid", + "bracketSpacing": true, + "bracketSameLine": true, + "printWidth": 100, + "semi": true, + "singleQuote": true, "trailingComma": "none", + "endOfLine": "lf", + "apexInsertFinalNewline": false, "useTabs": true, "overrides": [ { "files": "**/lwc/**/*.html", "options": { "parser": "lwc" } }, + { + "files": "*.{cls,trigger}", + "options": { "parser": "apex", "tabWidth": 2, "useTabs": true } + }, + { + "files": "*.trigger", + "options": { "printWidth": 200 } + }, { "files": "*.{cmp,page,component}", - "options": { "parser": "html" } + "options": { + "parser": "html", + "useTabs": true, + "htmlWhitespaceSensitivity": "css" + } + }, + { + "files": "*.{apex,soql}", + "options": { "parser": "apex-anonymous" } + }, + { + "files": "*.{yml,yaml}", + "options": { "parser": "yaml", "tabWidth": 2, "useTabs": false } + }, + { + "files": ".prettier*", + "options": { "parser": "json", "printWidth": 80, "useTabs": true } + }, + { + "files": "*.xml", + "options": { + "parser": "xml", + "useTabs": true, + "singleQuote": false, + "xmlSelfClosingSpace": true + } + }, + { + "files": ["**/pmd/*.xml", "*ruleset*.xml", "config/**/*.xml"], + "options": { + "parser": "xml", + "xmlSelfClosingSpace": true, + "xmlWhitespaceSensitivity": "ignore" + } + }, + { + "files": "*meta.xml", + "options": { + "parser": "xml", + "useTabs": false, + "xmlSelfClosingSpace": false + } + }, + { + "files": "*.json", + "options": { + "parser": "json-stringify", + "useTabs": false, + "tabWidth": 2 + } } - ] + ], + "plugins": ["prettier-plugin-apex", "@prettier/plugin-xml"], + "$schema": "https://json.schemastore.org/prettierrc" } diff --git a/package.json b/package.json index 5e29681..2377e4c 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,6 @@ }, "devDependencies": { "@prettier/plugin-xml": "^3.4.1", - "eslint": "^9.22.0", - "eslint-config-prettier": "^10.1.1", "husky": "^9.1.7", "lint-staged": "^15.5.0", "prettier": "3.5.3", diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls index 61b81f4..8d9c274 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandler.cls +++ b/trigger-actions-framework/main/default/classes/FinalizerHandler.cls @@ -121,10 +121,7 @@ public with sharing virtual class FinalizerHandler { * @param finalizerMetadata The metadata of the finalizer to execute. * @param context The context to pass to the finalizer's `execute` method. */ - private void callReferencedFinalizer( - DML_Finalizer__mdt finalizerMetadata, - Context context - ) { + private void callReferencedFinalizer(DML_Finalizer__mdt finalizerMetadata, Context context) { Object dynamicInstance; String className = finalizerMetadata.Apex_Class_Name__c; if (FinalizerHandler.isBypassed(className)) { @@ -166,9 +163,7 @@ public with sharing virtual class FinalizerHandler { } private void handleFinalizerException(String errorFormat, String className) { - throw new FinalizerException( - String.format(errorFormat, new List{ className }) - ); + throw new FinalizerException(String.format(errorFormat, new List{ className })); } /** @@ -178,10 +173,7 @@ public with sharing virtual class FinalizerHandler { * @param requiredPermission The required permission for the finalizer. * @return True if bypassed, false otherwise. */ - private boolean isBypassed( - String bypassPermission, - String requiredPermission - ) { + private boolean isBypassed(String bypassPermission, String requiredPermission) { return (bypassPermission != null && permissionMap.get(bypassPermission)) || (requiredPermission != null && !permissionMap.get(requiredPermission)); } @@ -192,10 +184,7 @@ public with sharing virtual class FinalizerHandler { */ private void populatePermissionMap(String permissionName) { if (permissionName != null && !permissionMap.containsKey(permissionName)) { - permissionMap.put( - permissionName, - FeatureManagement.checkPermission(permissionName) - ); + permissionMap.put(permissionName, FeatureManagement.checkPermission(permissionName)); } } @@ -231,8 +220,7 @@ public with sharing virtual class FinalizerHandler { * equal to, or greater than the specified object. */ public Integer compareTo(Object other) { - Decimal difference = (this.metadata.Order__c - - ((FinalizerSorter) other).metadata.Order__c); + Decimal difference = (this.metadata.Order__c - ((FinalizerSorter) other).metadata.Order__c); return difference < 0 ? -1 : difference == 0 ? 0 : 1; } } @@ -249,4 +237,4 @@ public with sharing virtual class FinalizerHandler { */ private class FinalizerException extends Exception { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls index 637fbb8..1c89cc7 100644 --- a/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls +++ b/trigger-actions-framework/main/default/classes/FinalizerHandlerTest.cls @@ -94,10 +94,7 @@ private with sharing class FinalizerHandlerTest { @IsTest private static void staticallyBypassedFinalizerShouldNotExecute() { handler.allFinalizers = new List{ - new DML_Finalizer__mdt( - Apex_Class_Name__c = TEST_FOO_FINALIZER, - Order__c = 1 - ) + new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_FOO_FINALIZER, Order__c = 1) }; FinalizerHandler.bypass(TEST_FOO_FINALIZER); @@ -150,14 +147,8 @@ private with sharing class FinalizerHandlerTest { @IsTest private static void finalizersShouldExecuteInOrder() { handler.allFinalizers = new List{ - new DML_Finalizer__mdt( - Apex_Class_Name__c = TEST_FOO_FINALIZER, - Order__c = 1 - ), - new DML_Finalizer__mdt( - Apex_Class_Name__c = TEST_BAR_FINALIZER, - Order__c = 2 - ) + new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_FOO_FINALIZER, Order__c = 1), + new DML_Finalizer__mdt(Apex_Class_Name__c = TEST_BAR_FINALIZER, Order__c = 2) }; handler.handleDynamicFinalizers(); @@ -213,10 +204,7 @@ private with sharing class FinalizerHandlerTest { System.Assert.isNotNull(myException, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format( - FinalizerHandler.INVALID_TYPE_ERROR_FINALIZER, - new List{ MY_CLASS } - ), + String.format(FinalizerHandler.INVALID_TYPE_ERROR_FINALIZER, new List{ MY_CLASS }), myException.getMessage(), EXCEPTION_SHOULD_HAVE_CORRECT_MESSAGE ); @@ -307,4 +295,4 @@ private with sharing class FinalizerHandlerTest { Database.setSavepoint(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls index 6a28a43..a72ae1c 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeader.cls @@ -113,4 +113,4 @@ public with sharing class FlowChangeEventHeader { public Integer hashCode() { return JSON.serialize(this).hashCode(); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls index 32db838..2cf5e7d 100644 --- a/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls +++ b/trigger-actions-framework/main/default/classes/FlowChangeEventHeaderTest.cls @@ -23,10 +23,7 @@ private with sharing class FlowChangeEventHeaderTest { @IsTest private static void shouldBeAbleToConstruct() { - System.Assert.isNotNull( - header, - 'Unable to construct a FlowChangeEventHeader' - ); + System.Assert.isNotNull(header, 'Unable to construct a FlowChangeEventHeader'); } @IsTest @@ -36,9 +33,7 @@ private with sharing class FlowChangeEventHeaderTest { @IsTest private static void shouldBeAbleToCompare() { - FlowChangeEventHeader other = new FlowChangeEventHeader( - new EventBus.ChangeEventHeader() - ); + FlowChangeEventHeader other = new FlowChangeEventHeader(new EventBus.ChangeEventHeader()); other.changeType = 'CREATE'; System.Assert.areEqual( @@ -57,4 +52,4 @@ private with sharing class FlowChangeEventHeaderTest { 'Unable to detect difference between FlowChangeEventHeader and null' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FormulaFilter.cls b/trigger-actions-framework/main/default/classes/FormulaFilter.cls index 842eda5..37dd400 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilter.cls +++ b/trigger-actions-framework/main/default/classes/FormulaFilter.cls @@ -23,8 +23,7 @@ global class FormulaFilter { private static final String ERROR_PREFIX = 'Please check the `SObject_Trigger_Setting__mdt` metadata for the the {0} sObject.'; @TestVisible private static final String MISSING_CLASS_NAME = - ERROR_PREFIX + - ' The record is missing the `TriggerRecord_Class_Name__c` field.'; + ERROR_PREFIX + ' The record is missing the `TriggerRecord_Class_Name__c` field.'; @TestVisible private static final String INVALID_CLASS = ERROR_PREFIX + @@ -74,18 +73,14 @@ global class FormulaFilter { List triggerOld ) { FormulaFilter.Result result = new FormulaFilter.Result(); - String entryCriteriaFormula = this.triggerActionConfiguration - ?.Entry_Criteria__c; + String entryCriteriaFormula = this.triggerActionConfiguration?.Entry_Criteria__c; if (String.isBlank(entryCriteriaFormula)) { result.triggerNew = triggerNew; result.triggerOld = triggerOld; return result; } - String nameOfType = getNameOfType( - this.triggerActionConfiguration, - this.context - ); + String nameOfType = getNameOfType(this.triggerActionConfiguration, this.context); System.Type triggerRecordSubType = getType(nameOfType); FormulaEval.FormulaInstance fx = getFormulaInstance( triggerRecordSubType, @@ -97,10 +92,7 @@ global class FormulaFilter { for (Integer i = 0; i < size; i++) { SObject record = triggerNew?.get(i); SObject recordPrior = triggerOld?.get(i); - TriggerRecord toProcess = getTriggerRecord( - triggerRecordSubType, - nameOfType - ); + TriggerRecord toProcess = getTriggerRecord(triggerRecordSubType, nameOfType); toProcess.newSobject = record; toProcess.oldSobject = recordPrior; if ((Boolean) fx.evaluate(toProcess)) { @@ -120,28 +112,19 @@ global class FormulaFilter { System.Type response = System.Type.forName(className); if (response == null) { throw new IllegalArgumentException( - String.format( - INVALID_CLASS, - new List{ this.sObjectName, className } - ) + String.format(INVALID_CLASS, new List{ this.sObjectName, className }) ); } return response; } - private TriggerRecord getTriggerRecord( - System.Type triggerRecordSubType, - String nameOfType - ) { + private TriggerRecord getTriggerRecord(System.Type triggerRecordSubType, String nameOfType) { TriggerRecord dynamicInstance; try { dynamicInstance = (TriggerRecord) triggerRecordSubType.newInstance(); } catch (System.TypeException e) { throw new IllegalArgumentException( - String.format( - INVALID_SUBTYPE, - new List{ this.sObjectName, nameOfType } - ) + String.format(INVALID_SUBTYPE, new List{ this.sObjectName, nameOfType }) ); } return dynamicInstance; @@ -204,4 +187,4 @@ global class FormulaFilter { this.triggerOld = new List(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls index 478d9be..6ed1d4d 100644 --- a/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls +++ b/trigger-actions-framework/main/default/classes/FormulaFilterTest.cls @@ -13,9 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -@SuppressWarnings( - 'PMD.ApexUnitTestClassShouldHaveRunAs, PMD.AvoidGlobalModifier' -) +@SuppressWarnings('PMD.ApexUnitTestClassShouldHaveRunAs, PMD.AvoidGlobalModifier') @IsTest global class FormulaFilterTest { private static final String ACCOUNT_SOBJECT_NAME = 'Account'; @@ -45,21 +43,10 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); - System.Assert.areEqual( - 2, - result.triggerNew.size(), - 'The size of triggerNew should be 2' - ); - System.Assert.areEqual( - 2, - result.triggerOld.size(), - 'The size of triggerOld should be 2' - ); + System.Assert.areEqual(2, result.triggerNew.size(), 'The size of triggerNew should be 2'); + System.Assert.areEqual(2, result.triggerOld.size(), 'The size of triggerOld should be 2'); } @IsTest @@ -72,21 +59,10 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); - System.Assert.areEqual( - 2, - result.triggerNew.size(), - 'The size of triggerNew should be 2' - ); - System.Assert.areEqual( - 2, - result.triggerOld.size(), - 'The size of triggerNew should be 2' - ); + System.Assert.areEqual(2, result.triggerNew.size(), 'The size of triggerNew should be 2'); + System.Assert.areEqual(2, result.triggerOld.size(), 'The size of triggerNew should be 2'); } @IsTest @@ -98,26 +74,15 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); - System.Assert.areEqual( - 1, - result.triggerNew.size(), - 'There should be 1 record in triggerNew' - ); + System.Assert.areEqual(1, result.triggerNew.size(), 'There should be 1 record in triggerNew'); System.Assert.areEqual( 'Test Account 1', ((Account) result.triggerNew[0]).Name, 'The first record triggerNew should have a name of Test Account 1' ); - System.Assert.areEqual( - 1, - result.triggerOld.size(), - 'There should be 1 record in triggerNew' - ); + System.Assert.areEqual(1, result.triggerOld.size(), 'There should be 1 record in triggerNew'); System.Assert.areEqual( 'Test Account 1', ((Account) result.triggerOld[0]).Name, @@ -134,20 +99,11 @@ global class FormulaFilterTest { ACCOUNT_SOBJECT_NAME ); - FormulaFilter.Result result = filter.filterByEntryCriteria( - triggerNew, - triggerOld - ); + FormulaFilter.Result result = filter.filterByEntryCriteria(triggerNew, triggerOld); System.Assert.isNotNull(result, 'result should not be null'); - System.Assert.isTrue( - result.triggerNew.isEmpty(), - 'triggerNew should be empty' - ); - System.Assert.isTrue( - result.triggerOld.isEmpty(), - 'triggerOld should be empty' - ); + System.Assert.isTrue(result.triggerNew.isEmpty(), 'triggerNew should be empty'); + System.Assert.isTrue(result.triggerOld.isEmpty(), 'triggerOld should be empty'); } @IsTest @@ -168,10 +124,7 @@ global class FormulaFilterTest { System.Assert.isNotNull(caught, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format( - FormulaFilter.MISSING_CLASS_NAME, - new List{ ACCOUNT_SOBJECT_NAME } - ), + String.format(FormulaFilter.MISSING_CLASS_NAME, new List{ ACCOUNT_SOBJECT_NAME }), caught.getMessage(), 'The exception message should match the expected error' ); @@ -195,10 +148,7 @@ global class FormulaFilterTest { System.Assert.isNotNull(caught, EXCEPTION_SHOULD_BE_THROWN); System.Assert.areEqual( - String.format( - FormulaFilter.MISSING_CLASS_NAME, - new List{ ACCOUNT_SOBJECT_NAME } - ), + String.format(FormulaFilter.MISSING_CLASS_NAME, new List{ ACCOUNT_SOBJECT_NAME }), caught.getMessage(), 'The exception message should match the expected error' ); @@ -256,10 +206,7 @@ global class FormulaFilterTest { System.Assert.areEqual( String.format( FormulaFilter.INVALID_SUBTYPE, - new List{ - ACCOUNT_SOBJECT_NAME, - sobjectSetting.TriggerRecord_Class_Name__c - } + new List{ ACCOUNT_SOBJECT_NAME, sobjectSetting.TriggerRecord_Class_Name__c } ), caught.getMessage(), 'The exception message should match the expected error' @@ -285,10 +232,7 @@ global class FormulaFilterTest { System.Assert.areEqual( String.format( FormulaFilter.INVALID_CLASS, - new List{ - ACCOUNT_SOBJECT_NAME, - sobjectSetting.TriggerRecord_Class_Name__c - } + new List{ ACCOUNT_SOBJECT_NAME, sobjectSetting.TriggerRecord_Class_Name__c } ), caught.getMessage(), 'The exception message should match the expected error' @@ -368,4 +312,4 @@ global class FormulaFilterTest { } } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls index a4fa549..04e4a34 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandler.cls @@ -235,10 +235,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private void populatePermissionMap(String permissionName) { if (permissionName != null && !permissionMap.containsKey(permissionName)) { - permissionMap.put( - permissionName, - FeatureManagement.checkPermission(permissionName) - ); + permissionMap.put(permissionName, FeatureManagement.checkPermission(permissionName)); } } @@ -250,15 +247,9 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private list getActionMetadata(String relationshipName) { if (!sObjectToContextToActions.containsKey(this.sObjectName)) { - sObjectToContextToActions.put( - this.sObjectName, - new Map>() - ); + sObjectToContextToActions.put(this.sObjectName, new Map>()); } - if ( - !sObjectToContextToActions.get(this.sObjectName) - .containsKey(relationshipName) - ) { + if (!sObjectToContextToActions.get(this.sObjectName).containsKey(relationshipName)) { list result = new List(); String sObjectLocalName = this.sObjectName; List split = sObjectName.split(DOUBLE_UNDERSCORE); @@ -279,20 +270,16 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem } ); for ( - Trigger_Action__mdt actionMetadata : (List) selector.query( - queryString - ) + Trigger_Action__mdt actionMetadata : (List) selector.query(queryString) ) { if (shouldExecute(actionMetadata, relationshipName)) { result.add(actionMetadata); } } - sObjectToContextToActions.get(this.sObjectName) - .put(relationshipName, result); + sObjectToContextToActions.get(this.sObjectName).put(relationshipName, result); } - return sObjectToContextToActions.get(this.sObjectName) - .get(relationshipName); + return sObjectToContextToActions.get(this.sObjectName).get(relationshipName); } /** @@ -302,10 +289,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param relationshipName The name of the relationship. * @return True if the Trigger Action should be executed, false otherwise. */ - private Boolean shouldExecute( - Trigger_Action__mdt actionMetadata, - String relationshipName - ) { + private Boolean shouldExecute(Trigger_Action__mdt actionMetadata, String relationshipName) { String sObjectBypassPermissionName = (String) ((sObject_Trigger_Setting__mdt) actionMetadata.getSobject( relationshipName + RELATIONSHIP_SUFFIX )) @@ -328,8 +312,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem return !isBypassed( actionMetadata.Bypass_Permission__c, actionMetadata.Required_Permission__c - ) && - !isBypassed(sObjectBypassPermissionName, sObjectRequiredPermissionName); + ) && !isBypassed(sObjectBypassPermissionName, sObjectRequiredPermissionName); } /** @@ -339,10 +322,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param requiredPermission The required permission for the Trigger Action. * @return True if bypassed, false otherwise. */ - private static boolean isBypassed( - String bypassPermission, - String requiredPermission - ) { + private static boolean isBypassed(String bypassPermission, String requiredPermission) { return (bypassPermission != null && permissionMap.get(bypassPermission)) || (requiredPermission != null && !permissionMap.get(requiredPermission)); } @@ -364,16 +344,8 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem if (!canExecute(triggerMetadata)) { continue; } - this.validateType( - context, - triggerAction, - triggerMetadata.Apex_Class_Name__c - ); - FormulaFilter.Result filtered = new FormulaFilter( - triggerMetadata, - context, - this.sObjectName - ) + this.validateType(context, triggerAction, triggerMetadata.Apex_Class_Name__c); + FormulaFilter.Result filtered = new FormulaFilter(triggerMetadata, context, this.sObjectName) .filterByEntryCriteria(triggerNew, triggerOld); if ( @@ -387,12 +359,10 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem switch on context { when BEFORE_INSERT { - ((TriggerAction.BeforeInsert) triggerAction) - .beforeInsert(filtered.triggerNew); + ((TriggerAction.BeforeInsert) triggerAction).beforeInsert(filtered.triggerNew); } when AFTER_INSERT { - ((TriggerAction.AfterInsert) triggerAction) - .afterInsert(filtered.triggerNew); + ((TriggerAction.AfterInsert) triggerAction).afterInsert(filtered.triggerNew); } when BEFORE_UPDATE { ((TriggerAction.BeforeUpdate) triggerAction) @@ -403,16 +373,13 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem .afterUpdate(filtered.triggerNew, filtered.triggerOld); } when BEFORE_DELETE { - ((TriggerAction.BeforeDelete) triggerAction) - .beforeDelete(filtered.triggerOld); + ((TriggerAction.BeforeDelete) triggerAction).beforeDelete(filtered.triggerOld); } when AFTER_DELETE { - ((TriggerAction.AfterDelete) triggerAction) - .afterDelete(filtered.triggerOld); + ((TriggerAction.AfterDelete) triggerAction).afterDelete(filtered.triggerOld); } when AFTER_UNDELETE { - ((TriggerAction.AfterUndelete) triggerAction) - .afterUndelete(filtered.triggerNew); + ((TriggerAction.AfterUndelete) triggerAction).afterUndelete(filtered.triggerNew); } } } @@ -425,9 +392,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param context The TriggerOperation context for which to retrieve metadata. * @return A List of Trigger_Action__mdt metadata records corresponding to the given context. */ - private List getActionMetadata( - TriggerOperation context - ) { + private List getActionMetadata(TriggerOperation context) { List result; switch on context { when BEFORE_INSERT { @@ -474,15 +439,10 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem result = Type.forName(triggerMetadata.Apex_Class_Name__c).newInstance(); if (triggerMetadata.Flow_Name__c != null) { ((TriggerActionFlow) result).flowName = triggerMetadata.Flow_Name__c; - ((TriggerActionFlow) result) - .allowRecursion = triggerMetadata.Allow_Flow_Recursion__c; + ((TriggerActionFlow) result).allowRecursion = triggerMetadata.Allow_Flow_Recursion__c; } } catch (System.NullPointerException e) { - handleException( - INVALID_CLASS_ERROR, - triggerMetadata.Apex_Class_Name__c, - context - ); + handleException(INVALID_CLASS_ERROR, triggerMetadata.Apex_Class_Name__c, context); } return result; } @@ -496,9 +456,8 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @return True if the trigger action can be executed, false otherwise. */ private Boolean canExecute(Trigger_Action__mdt triggerMetadata) { - return !MetadataTriggerHandler.isBypassed( - triggerMetadata.Apex_Class_Name__c - ) && !TriggerBase.isBypassed(this.sObjectName); + return !MetadataTriggerHandler.isBypassed(triggerMetadata.Apex_Class_Name__c) && + !TriggerBase.isBypassed(this.sObjectName); } /** @@ -508,11 +467,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param triggerAction The Trigger Action object. * @param className The name of the Trigger Action class. */ - private void validateType( - TriggerOperation context, - Object triggerAction, - String className - ) { + private void validateType(TriggerOperation context, Object triggerAction, String className) { try { switch on context { when BEFORE_INSERT { @@ -549,19 +504,11 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem * @param className The name of the Trigger Action class. * @param triggerOperation The Trigger Operation context. */ - private void handleException( - String error, - String className, - TriggerOperation triggerOperation - ) { + private void handleException(String error, String className, TriggerOperation triggerOperation) { throw new MetadataTriggerHandlerException( String.format( error, - new List{ - className, - String.valueOf(triggerOperation), - this.sObjectName - } + new List{ className, String.valueOf(triggerOperation), this.sObjectName } ) ); } @@ -575,9 +522,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeInsertActionMetadata { get { if (beforeInsertActionMetadata == null) { - beforeInsertActionMetadata = getActionMetadata( - TriggerOperation.BEFORE_INSERT.name() - ); + beforeInsertActionMetadata = getActionMetadata(TriggerOperation.BEFORE_INSERT.name()); } return beforeInsertActionMetadata; } @@ -593,9 +538,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterInsertActionMetadata { get { if (afterInsertActionMetadata == null) { - afterInsertActionMetadata = getActionMetadata( - TriggerOperation.AFTER_INSERT.name() - ); + afterInsertActionMetadata = getActionMetadata(TriggerOperation.AFTER_INSERT.name()); } return afterInsertActionMetadata; } @@ -611,9 +554,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeUpdateActionMetadata { get { if (beforeUpdateActionMetadata == null) { - beforeUpdateActionMetadata = getActionMetadata( - TriggerOperation.BEFORE_UPDATE.name() - ); + beforeUpdateActionMetadata = getActionMetadata(TriggerOperation.BEFORE_UPDATE.name()); } return beforeUpdateActionMetadata; } @@ -629,9 +570,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterUpdateActionMetadata { get { if (afterUpdateActionMetadata == null) { - afterUpdateActionMetadata = getActionMetadata( - TriggerOperation.AFTER_UPDATE.name() - ); + afterUpdateActionMetadata = getActionMetadata(TriggerOperation.AFTER_UPDATE.name()); } return afterUpdateActionMetadata; } @@ -647,9 +586,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List beforeDeleteActionMetadata { get { if (beforeDeleteActionMetadata == null) { - beforeDeleteActionMetadata = getActionMetadata( - TriggerOperation.BEFORE_DELETE.name() - ); + beforeDeleteActionMetadata = getActionMetadata(TriggerOperation.BEFORE_DELETE.name()); } return beforeDeleteActionMetadata; } @@ -665,9 +602,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterDeleteActionMetadata { get { if (afterDeleteActionMetadata == null) { - afterDeleteActionMetadata = getActionMetadata( - TriggerOperation.AFTER_DELETE.name() - ); + afterDeleteActionMetadata = getActionMetadata(TriggerOperation.AFTER_DELETE.name()); } return afterDeleteActionMetadata; } @@ -683,9 +618,7 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem private List afterUndeleteActionMetadata { get { if (afterUndeleteActionMetadata == null) { - afterUndeleteActionMetadata = getActionMetadata( - TriggerOperation.AFTER_UNDELETE.name() - ); + afterUndeleteActionMetadata = getActionMetadata(TriggerOperation.AFTER_UNDELETE.name()); } return afterUndeleteActionMetadata; } @@ -710,4 +643,4 @@ public inherited sharing class MetadataTriggerHandler extends TriggerBase implem */ private class MetadataTriggerHandlerException extends Exception { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls index 20e394b..4110f09 100644 --- a/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls +++ b/trigger-actions-framework/main/default/classes/MetadataTriggerHandlerTest.cls @@ -14,9 +14,7 @@ limitations under the License. */ -@SuppressWarnings( - 'PMD.ApexDoc, PMD.CyclomaticComplexity, PMD.ApexUnitTestClassShouldHaveRunAs' -) +@SuppressWarnings('PMD.ApexDoc, PMD.CyclomaticComplexity, PMD.ApexUnitTestClassShouldHaveRunAs') @IsTest(isParallel=true) private class MetadataTriggerHandlerTest { private static final String ACCOUNT = 'Account'; @@ -51,9 +49,7 @@ private class MetadataTriggerHandlerTest { ); private static sObject_Trigger_Setting__mdt setting = new sObject_Trigger_Setting__mdt( Object_API_Name__c = ACCOUNT, - Id = TriggerTestUtility.getFakeId( - Schema.sObject_Trigger_Setting__mdt.SObjectType - ) + Id = TriggerTestUtility.getFakeId(Schema.sObject_Trigger_Setting__mdt.SObjectType) ); private static MetadataTriggerHandler handler = new MetadataTriggerHandler(); private static Boolean executed = false; @@ -73,9 +69,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldSucceed() { - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; handler.beforeInsert(handler.triggerNew); @@ -85,9 +79,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_AFTER_INSERT; - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; try { handler.beforeInsert(handler.triggerNew); @@ -113,9 +105,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeInsertShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; try { handler.beforeInsert(handler.triggerNew); @@ -203,9 +193,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldSucceed() { action.Apex_Class_Name__c = TEST_BEFORE_UPDATE; - handler.beforeUpdateActionMetadata = new List{ - action - }; + handler.beforeUpdateActionMetadata = new List{ action }; handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -215,9 +203,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.beforeUpdateActionMetadata = new List{ - action - }; + handler.beforeUpdateActionMetadata = new List{ action }; try { handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -243,9 +229,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeUpdateShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeUpdateActionMetadata = new List{ - action - }; + handler.beforeUpdateActionMetadata = new List{ action }; try { handler.beforeUpdate(handler.triggerNew, handler.triggerOld); @@ -333,9 +317,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldSucceed() { action.Apex_Class_Name__c = TEST_BEFORE_DELETE; - handler.beforeDeleteActionMetadata = new List{ - action - }; + handler.beforeDeleteActionMetadata = new List{ action }; handler.beforeDelete(handler.triggerOld); @@ -345,9 +327,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.beforeDeleteActionMetadata = new List{ - action - }; + handler.beforeDeleteActionMetadata = new List{ action }; try { handler.beforeDelete(handler.triggerOld); @@ -373,9 +353,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void beforeDeleteShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.beforeDeleteActionMetadata = new List{ - action - }; + handler.beforeDeleteActionMetadata = new List{ action }; try { handler.beforeDelete(handler.triggerOld); @@ -463,9 +441,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldSucceed() { action.Apex_Class_Name__c = TEST_AFTER_UNDELETE; - handler.afterUndeleteActionMetadata = new List{ - action - }; + handler.afterUndeleteActionMetadata = new List{ action }; handler.afterUndelete(handler.triggerOld); @@ -475,9 +451,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldFailWithIncorrectType() { action.Apex_Class_Name__c = TEST_BEFORE_INSERT; - handler.afterUndeleteActionMetadata = new List{ - action - }; + handler.afterUndeleteActionMetadata = new List{ action }; try { handler.afterUndelete(handler.triggerOld); @@ -503,9 +477,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void afterUndeleteShouldFailWithIncorrectClass() { action.Apex_Class_Name__c = BOGUS_CLASS_NAME; - handler.afterUndeleteActionMetadata = new List{ - action - }; + handler.afterUndeleteActionMetadata = new List{ action }; try { handler.afterUndelete(handler.triggerOld); @@ -530,9 +502,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void nothingToProcessShouldExitEarly() { - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; handler.beforeInsert(new List()); @@ -633,9 +603,7 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldExecuteIfNoRequiredOrBypassPermissionsAreDefinedForSObjectOrAction() { - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); MetadataTriggerHandler.permissionMap.clear(); @@ -648,9 +616,7 @@ private class MetadataTriggerHandlerTest { private static void actionShouldExecuteIfUserDoesNotHaveBypassPermissionForSObjectOrAction() { setting.Bypass_Permission__c = BYPASS_PERMISSION; action.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); MetadataTriggerHandler.permissionMap.clear(); @@ -662,12 +628,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserDoesNotHaveRequiredPermissionForSObject() { setting.Required_Permission__c = REQUIRED_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - REQUIRED_PERMISSION => false - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ REQUIRED_PERMISSION => false }; handler.beforeInsert(handler.triggerNew); @@ -677,12 +639,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserDoesNotHaveRequiredPermissionForAction() { action.Required_Permission__c = REQUIRED_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - REQUIRED_PERMISSION => false - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ REQUIRED_PERMISSION => false }; handler.beforeInsert(handler.triggerNew); @@ -692,12 +650,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserHasBypassPermissionForSObject() { setting.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - BYPASS_PERMISSION => true - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ BYPASS_PERMISSION => true }; handler.beforeInsert(handler.triggerNew); @@ -707,12 +661,8 @@ private class MetadataTriggerHandlerTest { @IsTest private static void actionShouldNotExecuteIfUserHasBypassPermissionForAction() { action.Bypass_Permission__c = BYPASS_PERMISSION; - MetadataTriggerHandler.selector = new FakeSelector( - new List{ action } - ); - MetadataTriggerHandler.permissionMap = new Map{ - BYPASS_PERMISSION => true - }; + MetadataTriggerHandler.selector = new FakeSelector(new List{ action }); + MetadataTriggerHandler.permissionMap = new Map{ BYPASS_PERMISSION => true }; handler.beforeInsert(handler.triggerNew); @@ -735,9 +685,7 @@ private class MetadataTriggerHandlerTest { action.Allow_Flow_Recursion__c = false; MetadataTriggerHandler.bypass(TriggerActionFlow.class.getName()); - handler.beforeInsertActionMetadata = new List{ - action - }; + handler.beforeInsertActionMetadata = new List{ action }; try { handler.beforeInsert(handler.triggerNew); @@ -759,18 +707,12 @@ private class MetadataTriggerHandlerTest { } } public class TestBeforeUpdate implements TriggerAction.BeforeUpdate { - public void beforeUpdate( - List triggerNew, - List triggerOld - ) { + public void beforeUpdate(List triggerNew, List triggerOld) { MetadataTriggerHandlerTest.executed = true; } } public class TestAfterUpdate implements TriggerAction.AfterUpdate { - public void afterUpdate( - List triggerNew, - List triggerOld - ) { + public void afterUpdate(List triggerNew, List triggerOld) { MetadataTriggerHandlerTest.executed = true; } } @@ -804,4 +746,4 @@ private class MetadataTriggerHandlerTest { return this.results; } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerAction.cls b/trigger-actions-framework/main/default/classes/TriggerAction.cls index 59f2fea..9144621 100644 --- a/trigger-actions-framework/main/default/classes/TriggerAction.cls +++ b/trigger-actions-framework/main/default/classes/TriggerAction.cls @@ -132,4 +132,4 @@ public class TriggerAction { */ void execute(FinalizerHandler.Context context); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls index accf2a9..eec95aa 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionConstants.cls @@ -31,4 +31,4 @@ public class TriggerActionConstants { TriggerActionConstants.FLOW_STRING, TriggerActionConstants.OBJECT_STRING }; -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls index f4fdfce..1818091 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlow.cls @@ -104,9 +104,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE) - ), + invokeAction(getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE)), triggerNew ); } @@ -158,8 +156,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio for (Integer i = 0; i < triggerNew.size(); i++) { sObject record = triggerNew[i]; if ( - TriggerBase.idToNumberOfTimesSeenAfterUpdate.get(record.id) == 1 || - (allowRecursion == true) + TriggerBase.idToNumberOfTimesSeenAfterUpdate.get(record.id) == 1 || (allowRecursion == true) ) { recordsNotYetProcessed.add(record); oldRecordsNotYetProcessed.add(triggerOld[i]); @@ -169,9 +166,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs(recordsNotYetProcessed, oldRecordsNotYetProcessed) - ), + invokeAction(getInterviewInputs(recordsNotYetProcessed, oldRecordsNotYetProcessed)), recordsNotYetProcessed ); } @@ -186,12 +181,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs( - triggerOld, - TriggerActionConstants.RECORD_PRIOR_VARIABLE - ) - ), + invokeAction(getInterviewInputs(triggerOld, TriggerActionConstants.RECORD_PRIOR_VARIABLE)), triggerOld ); } @@ -206,12 +196,7 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs( - triggerOld, - TriggerActionConstants.RECORD_PRIOR_VARIABLE - ) - ), + invokeAction(getInterviewInputs(triggerOld, TriggerActionConstants.RECORD_PRIOR_VARIABLE)), triggerOld ); } @@ -226,40 +211,27 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return; } handleInvocableResults( - invokeAction( - getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE) - ), + invokeAction(getInterviewInputs(triggerNew, TriggerActionConstants.RECORD_VARIABLE)), triggerNew ); } private Boolean flowIsBypassed() { if (String.isBlank(flowName)) { - throw new IllegalArgumentException( - TriggerActionConstants.INVALID_FLOW_NAME - ); + throw new IllegalArgumentException(TriggerActionConstants.INVALID_FLOW_NAME); } return TriggerActionFlow.isBypassed(flowName); } - private List invokeAction( - List> inputs - ) { + private List invokeAction(List> inputs) { return invocableAction.invokeAction(this.flowName, inputs); } - private void applyFlowValues( - sObject stateBeforeFlow, - sObject stateAfterFlow - ) { + private void applyFlowValues(sObject stateBeforeFlow, sObject stateAfterFlow) { Boolean hasBeenMutated = false; Set recordPopulatedFields = new Set(); - recordPopulatedFields.addAll( - stateAfterFlow.getPopulatedFieldsAsMap().keySet() - ); - recordPopulatedFields.addAll( - stateBeforeFlow.getPopulatedFieldsAsMap().keySet() - ); + recordPopulatedFields.addAll(stateAfterFlow.getPopulatedFieldsAsMap().keySet()); + recordPopulatedFields.addAll(stateBeforeFlow.getPopulatedFieldsAsMap().keySet()); for (String fieldName : recordPopulatedFields) { if (stateBeforeFlow.get(fieldName) != stateAfterFlow.get(fieldName)) { stateBeforeFlow.put(fieldName, stateAfterFlow.get(fieldName)); @@ -380,4 +352,4 @@ public virtual inherited sharing class TriggerActionFlow implements TriggerActio return action.invoke(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls index 824e100..ffa9674 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddError.cls @@ -55,22 +55,11 @@ public inherited sharing class TriggerActionFlowAddError { * @description This class represents a request to add an error to an sObject. */ public class Request { - @InvocableVariable( - label='Record' - description='Record to add the error to' - required=true - ) + @InvocableVariable(label='Record' description='Record to add the error to' required=true) public SObject record; - @InvocableVariable( - label='Field Name' - description='API name of corresponding field' - ) + @InvocableVariable(label='Field Name' description='API name of corresponding field') public String fieldName; - @InvocableVariable( - label='Error Message' - description='Error Message' - required=true - ) + @InvocableVariable(label='Error Message' description='Error Message' required=true) public String errorMessage; } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls index 870a4f7..2d5938a 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowAddErrorTest.cls @@ -31,15 +31,8 @@ private class TriggerActionFlowAddErrorTest { TriggerActionFlowAddError.addError(requests); - System.Assert.isTrue( - account.hasErrors(), - 'The Account should have an error' - ); - System.Assert.areEqual( - 1, - account.getErrors().size(), - 'There should only be one error' - ); + System.Assert.isTrue(account.hasErrors(), 'The Account should have an error'); + System.Assert.areEqual(1, account.getErrors().size(), 'There should only be one error'); System.Assert.areEqual( MY_STRING, account.getErrors()[0].getMessage(), @@ -57,19 +50,12 @@ private class TriggerActionFlowAddErrorTest { TriggerActionFlowAddError.addError(requests); - System.Assert.isTrue( - account.hasErrors(), - 'The Account should have an error' - ); - System.Assert.areEqual( - 1, - account.getErrors().size(), - 'There should only be one error' - ); + System.Assert.isTrue(account.hasErrors(), 'The Account should have an error'); + System.Assert.areEqual(1, account.getErrors().size(), 'There should only be one error'); System.Assert.areEqual( MY_STRING, account.getErrors()[0].getMessage(), 'The error should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls index 239deed..ed1d30c 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypass.cls @@ -54,11 +54,7 @@ public inherited sharing class TriggerActionFlowBypass { required=true ) public String name; - @InvocableVariable( - label='Bypass Type' - description='Apex, Flow, or Object' - required=true - ) + @InvocableVariable(label='Bypass Type' description='Apex, Flow, or Object' required=true) public String bypassType; } @@ -75,4 +71,4 @@ public inherited sharing class TriggerActionFlowBypass { TriggerBase.bypass(name); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls index 0c94720..7230976 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassProcessor.cls @@ -46,4 +46,4 @@ public inherited sharing abstract class TriggerActionFlowBypassProcessor { protected abstract void processApexBypasses(String requestType); protected abstract void processFlowBypasses(String requestType); protected abstract void processObjectBypasses(String requestType); -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls index 2a7f250..89fa148 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowBypassTest.cls @@ -30,10 +30,7 @@ private class TriggerActionFlowBypassTest { TriggerActionFlowBypass.bypass(requests); - System.Assert.isTrue( - TriggerBase.isBypassed(MY_STRING), - 'The Object should be bypassed' - ); + System.Assert.isTrue(TriggerBase.isBypassed(MY_STRING), 'The Object should be bypassed'); } @IsTest @@ -58,10 +55,7 @@ private class TriggerActionFlowBypassTest { TriggerActionFlowBypass.bypass(requests); - System.Assert.isTrue( - TriggerActionFlow.isBypassed(MY_STRING), - 'The Flow should be bypassed' - ); + System.Assert.isTrue(TriggerActionFlow.isBypassed(MY_STRING), 'The Flow should be bypassed'); } @IsTest @@ -92,4 +86,4 @@ private class TriggerActionFlowBypassTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls index 45efc9b..2869b6e 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEvent.cls @@ -66,4 +66,4 @@ public with sharing class TriggerActionFlowChangeEvent extends TriggerActionFlow throw new IllegalArgumentException(NOT_CHANGE_EVENT_ERROR); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls index 4c3068a..b8c5de8 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowChangeEventTest.cls @@ -95,4 +95,4 @@ private with sharing class TriggerActionFlowChangeEventTest { 'The value for "header" is constructed improperly' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls index a4aa158..64fe2bf 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypasses.cls @@ -60,4 +60,4 @@ public inherited sharing class TriggerActionFlowClearAllBypasses { TriggerBase.clearAllBypasses(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls index 503ff66..76300d9 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearAllBypassesTest.cls @@ -27,10 +27,7 @@ private class TriggerActionFlowClearAllBypassesTest { new List{ TriggerActionConstants.OBJECT_STRING } ); - System.Assert.isFalse( - TriggerBase.isBypassed(MY_STRING), - 'The Object should not be bypassed' - ); + System.Assert.isFalse(TriggerBase.isBypassed(MY_STRING), 'The Object should not be bypassed'); } @IsTest @@ -66,9 +63,7 @@ private class TriggerActionFlowClearAllBypassesTest { Exception myException; try { - TriggerActionFlowClearAllBypasses.clearAllBypasses( - new List{ MY_STRING } - ); + TriggerActionFlowClearAllBypasses.clearAllBypasses(new List{ MY_STRING }); } catch (Exception e) { myException = e; } @@ -89,4 +84,4 @@ private class TriggerActionFlowClearAllBypassesTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls index 6c9dd81..14aae99 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypass.cls @@ -62,11 +62,7 @@ public inherited sharing class TriggerActionFlowClearBypass { required=true ) public String name; - @InvocableVariable( - label='Bypass Type' - description='Apex, Flow, or Object' - required=true - ) + @InvocableVariable(label='Bypass Type' description='Apex, Flow, or Object' required=true) public String bypassType; } @@ -91,4 +87,4 @@ public inherited sharing class TriggerActionFlowClearBypass { TriggerBase.clearBypass(name); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls index aec67e1..1894cfa 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowClearBypassTest.cls @@ -31,10 +31,7 @@ private class TriggerActionFlowClearBypassTest { TriggerActionFlowClearBypass.clearBypass(requests); - System.Assert.isFalse( - TriggerBase.isBypassed(MY_STRING), - 'The Object should not be bypassed' - ); + System.Assert.isFalse(TriggerBase.isBypassed(MY_STRING), 'The Object should not be bypassed'); } @IsTest @@ -95,4 +92,4 @@ private class TriggerActionFlowClearBypassTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls index 1b90586..3d20019 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassed.cls @@ -95,4 +95,4 @@ public inherited sharing class TriggerActionFlowIsBypassed { this.hasBeenBypassed = TriggerBase.isBypassed(name); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls index 8a0bd6d..73aedde 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowIsBypassedTest.cls @@ -30,11 +30,7 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual( - 1, - isBypassed.size(), - 'We should only have one result for our request' - ); + System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); System.Assert.areEqual( TriggerBase.isBypassed(MY_STRING), isBypassed[0], @@ -50,11 +46,7 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual( - 1, - isBypassed.size(), - 'We should only have one result for our request' - ); + System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); System.Assert.areEqual( MetadataTriggerHandler.isBypassed(MY_STRING), isBypassed[0], @@ -70,11 +62,7 @@ private class TriggerActionFlowIsBypassedTest { List isBypassed = TriggerActionFlowIsBypassed.isBypassed(requests); - System.Assert.areEqual( - 1, - isBypassed.size(), - 'We should only have one result for our request' - ); + System.Assert.areEqual(1, isBypassed.size(), 'We should only have one result for our request'); System.Assert.areEqual( TriggerActionFlow.isBypassed(MY_STRING), isBypassed[0], @@ -111,4 +99,4 @@ private class TriggerActionFlowIsBypassedTest { 'The exeption should contain the message we are looking for' ); } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls index b9d9a0f..707b4c0 100644 --- a/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerActionFlowTest.cls @@ -39,10 +39,7 @@ private class TriggerActionFlowTest { Name = MY_ACCOUNT, Id = TriggerTestUtility.getFakeId(Schema.Account.SObjectType) ); - private static Account oldAccount = new Account( - Name = OLD_NAME, - Id = myAccount.Id - ); + private static Account oldAccount = new Account(Name = OLD_NAME, Id = myAccount.Id); private static Account myAccountAfterFlow = myAccount.clone(true); private static List triggerNew = new List{ myAccount }; private static List triggerOld = new List{ oldAccount }; @@ -52,9 +49,7 @@ private class TriggerActionFlowTest { private static Invocable.Action.Result successResult = new InvocableActionResultBuilder() .setSuccess(true) .setOutputParameters( - new Map{ - TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow - } + new Map{ TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow } ) .build(); @@ -135,22 +130,14 @@ private class TriggerActionFlowTest { System.Assert.areEqual(FOO, myAccount.Name, NAME_SET_FROM_FLOW); System.Assert.areEqual(true, myAccount.hasErrors(), ERROR_SHOULD_BE_ADDED); System.Assert.areEqual(1, myAccount.getErrors().size(), ONE_ERROR); - System.Assert.areEqual( - TEST, - myAccount.getErrors()[0].getMessage(), - ERROR_MESSAGE_SHOULD_MATCH - ); + System.Assert.areEqual(TEST, myAccount.getErrors()[0].getMessage(), ERROR_MESSAGE_SHOULD_MATCH); } @IsTest private static void afterInsertShouldSucceed() { actionFlow.afterInsert(triggerNew); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -160,11 +147,7 @@ private class TriggerActionFlowTest { System.Assert.areEqual(FOO, myAccount.Name, NAME_SET_FROM_FLOW); System.Assert.areEqual(true, myAccount.hasErrors(), ERROR_SHOULD_BE_ADDED); System.Assert.areEqual(1, myAccount.getErrors().size(), ONE_ERROR); - System.Assert.areEqual( - TEST, - myAccount.getErrors()[0].getMessage(), - ERROR_MESSAGE_SHOULD_MATCH - ); + System.Assert.areEqual(TEST, myAccount.getErrors()[0].getMessage(), ERROR_MESSAGE_SHOULD_MATCH); } @IsTest @@ -181,11 +164,7 @@ private class TriggerActionFlowTest { private static void afterUpdateShouldSucceed() { actionFlow.afterUpdate(triggerNew, triggerOld); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -195,44 +174,28 @@ private class TriggerActionFlowTest { actionFlow.afterUpdate(triggerNew, triggerOld); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest private static void beforeDeleteShouldSucceed() { actionFlow.beforeDelete(triggerOld); - System.Assert.areEqual( - false, - oldAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, oldAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest private static void afterDeleteShouldSucceed() { actionFlow.afterDelete(triggerOld); - System.Assert.areEqual( - false, - oldAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, oldAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest private static void afterUndeleteShouldSucceed() { actionFlow.afterUndelete(triggerOld); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -249,24 +212,18 @@ private class TriggerActionFlowTest { System.Assert.areEqual( true, - myException.getMessage() - .contains(TriggerActionFlow.RECORD_VARIABLE_NOT_FOUND_ERROR), + myException.getMessage().contains(TriggerActionFlow.RECORD_VARIABLE_NOT_FOUND_ERROR), EXCEPTION_SHOULD_HAVE_THE_CORRECT_MESSAGE ); } @IsTest private static void noRecordMutationsShouldSucceed() { - successResult.getOutputParameters() - .put(TriggerActionConstants.RECORD_VARIABLE, myAccount); + successResult.getOutputParameters().put(TriggerActionConstants.RECORD_VARIABLE, myAccount); actionFlow.beforeInsert(triggerNew); - System.Assert.areEqual( - false, - myAccount.hasErrors(), - ERROR_SHOULD_NOT_BE_ADDED - ); + System.Assert.areEqual(false, myAccount.hasErrors(), ERROR_SHOULD_NOT_BE_ADDED); } @IsTest @@ -288,16 +245,11 @@ private class TriggerActionFlowTest { new InvocableActionResultBuilder() .setSuccess(false) .setOutputParameters( - new Map{ - TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow - } + new Map{ TriggerActionConstants.RECORD_VARIABLE => myAccountAfterFlow } ) .setErrors( new List{ - new InvocableActionErrorBuilder() - .setCode(TEST) - .setMessage(FOO) - .build() + new InvocableActionErrorBuilder().setCode(TEST).setMessage(FOO).build() } ) .build() @@ -362,17 +314,10 @@ private class TriggerActionFlowTest { @IsTest private static void invokeFlowShouldReturnUnsuccessfulResponseWithBogusFlowName() { List results = new TriggerActionFlow.InvocableAction() - .invokeAction( - BOGUS, - new List>{ new Map() } - ); + .invokeAction(BOGUS, new List>{ new Map() }); System.Assert.areEqual(1, results.size(), ONE_ERROR); - System.Assert.areEqual( - false, - results[0].isSuccess(), - 'It should have failed with bogus name' - ); + System.Assert.areEqual(false, results[0].isSuccess(), 'It should have failed with bogus name'); } private virtual class FakeInvocableAction extends TriggerActionFlow.InvocableAction { @@ -394,9 +339,7 @@ private class TriggerActionFlowTest { private Invocable.Action action; private List errors; - public InvocableActionResultBuilder setOutputParameters( - Map outputParameters - ) { + public InvocableActionResultBuilder setOutputParameters(Map outputParameters) { this.outputParameters = outputParameters; return this; } @@ -408,9 +351,7 @@ private class TriggerActionFlowTest { this.action = action; return this; } - public InvocableActionResultBuilder setErrors( - List errors - ) { + public InvocableActionResultBuilder setErrors(List errors) { this.errors = errors; return this; } @@ -447,11 +388,9 @@ private class TriggerActionFlowTest { public Invocable.Action.error build() { return (Invocable.Action.error) JSON.deserialize( - JSON.serialize( - new Map{ 'code' => code, 'message' => message } - ), + JSON.serialize(new Map{ 'code' => code, 'message' => message }), Invocable.Action.error.class ); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerBase.cls b/trigger-actions-framework/main/default/classes/TriggerBase.cls index 61389ec..dd46e62 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBase.cls +++ b/trigger-actions-framework/main/default/classes/TriggerBase.cls @@ -192,15 +192,13 @@ public inherited sharing virtual class TriggerBase { this instanceof TriggerAction.BeforeUpdate ) { this.incrementUpdateCounts(this.context, this.triggerNew); - ((TriggerAction.BeforeUpdate) this) - .beforeUpdate(this.triggerNew, this.triggerOld); + ((TriggerAction.BeforeUpdate) this).beforeUpdate(this.triggerNew, this.triggerOld); } else if ( this.context == System.TriggerOperation.AFTER_UPDATE && this instanceof TriggerAction.AfterUpdate ) { this.incrementUpdateCounts(this.context, this.triggerNew); - ((TriggerAction.AfterUpdate) this) - .afterUpdate(this.triggerNew, this.triggerOld); + ((TriggerAction.AfterUpdate) this).afterUpdate(this.triggerNew, this.triggerOld); } else if ( this.context == System.TriggerOperation.BEFORE_DELETE && this instanceof TriggerAction.BeforeDelete @@ -252,9 +250,7 @@ public inherited sharing virtual class TriggerBase { List records ) { for (SObject obj : records) { - Map idToUpdateCount = CONTEXT_TO_UPDATE_COUNT.get( - triggerContext - ); + Map idToUpdateCount = CONTEXT_TO_UPDATE_COUNT.get(triggerContext); Integer updateCount = idToUpdateCount.get(obj.Id); if (updateCount == null) { updateCount = 0; @@ -313,10 +309,7 @@ public inherited sharing virtual class TriggerBase { protected String sObjectName { get { if (sObjectName == null) { - sObjectName = this.sObjectType.getDescribe( - SObjectDescribeOptions.DEFERRED - ) - .getName(); + sObjectName = this.sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getName(); } return sObjectName; } @@ -358,9 +351,7 @@ public inherited sharing virtual class TriggerBase { private Integer triggerSize { get { - return triggerNew != null - ? triggerNew.size() - : triggerOld != null ? triggerOld.size() : 0; + return triggerNew != null ? triggerNew.size() : triggerOld != null ? triggerOld.size() : 0; } } @@ -428,4 +419,4 @@ public inherited sharing virtual class TriggerBase { @TestVisible private class EmptyStackException extends Exception { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls index 54e65f9..0687010 100644 --- a/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerBaseTest.cls @@ -70,16 +70,8 @@ private class TriggerBaseTest { base.triggerNew = null; base.triggerOld = null; - System.Assert.areEqual( - null, - base.triggerNew, - 'triggerNew should match Trigger.new' - ); - System.Assert.areEqual( - null, - base.triggerOld, - 'triggerOld should match Trigger.old' - ); + System.Assert.areEqual(null, base.triggerNew, 'triggerNew should match Trigger.new'); + System.Assert.areEqual(null, base.triggerOld, 'triggerOld should match Trigger.old'); } @IsTest @@ -182,11 +174,7 @@ private class TriggerBaseTest { myException = e; } - System.Assert.areNotEqual( - null, - myException, - 'An exception should be thrown' - ); + System.Assert.areNotEqual(null, myException, 'An exception should be thrown'); System.Assert.areEqual( TriggerBase.HANDLER_OUTSIDE_TRIGGER_MESSAGE, myException.getMessage(), @@ -276,10 +264,7 @@ private class TriggerBaseTest { private static void isBypassedShouldSucceed() { TriggerBase.bypass(ACCOUNT); - System.Assert.isTrue( - TriggerBase.isBypassed(ACCOUNT), - BYPASSES_SHOULD_BE_CONFIGURED_CORRECTLY - ); + System.Assert.isTrue(TriggerBase.isBypassed(ACCOUNT), BYPASSES_SHOULD_BE_CONFIGURED_CORRECTLY); } @IsTest @@ -299,11 +284,7 @@ private class TriggerBaseTest { private static void offsetRowsShouldWork() { TriggerBase.offsetExistingDmlRows(); - System.Assert.areEqual( - 0, - TriggerBase.existingDmlRowsOffset, - 'Offset is not working properly' - ); + System.Assert.areEqual(0, TriggerBase.existingDmlRowsOffset, 'Offset is not working properly'); } @IsTest @@ -343,10 +324,7 @@ private class TriggerBaseTest { stack.push(FIRST); stack.pop(); - System.Assert.isTrue( - stack.isEmpty(), - 'The stack is empty but unable to identify as such' - ); + System.Assert.isTrue(stack.isEmpty(), 'The stack is empty but unable to identify as such'); } @IsTest @@ -387,11 +365,7 @@ private class TriggerBaseTest { stack.push(SECOND); stack.push(THIRD); - System.Assert.areEqual( - THIRD, - stack.peek(), - 'The last element in the stack is not peeked' - ); + System.Assert.areEqual(THIRD, stack.peek(), 'The last element in the stack is not peeked'); } @IsTest @@ -401,11 +375,7 @@ private class TriggerBaseTest { stack.push(SECOND); stack.push(THIRD); - System.Assert.areEqual( - 3, - stack.depth(), - 'The stack is not properly calculating its depth' - ); + System.Assert.areEqual(3, stack.depth(), 'The stack is not properly calculating its depth'); } @IsTest @@ -452,16 +422,10 @@ private class TriggerBaseTest { public void afterInsert(List triggerNew) { this.executed = true; } - public void beforeUpdate( - List triggerNew, - List triggerOld - ) { + public void beforeUpdate(List triggerNew, List triggerOld) { this.executed = true; } - public void afterUpdate( - List triggerNew, - List triggerOld - ) { + public void afterUpdate(List triggerNew, List triggerOld) { this.executed = true; } public void beforeDelete(List triggerOld) { @@ -484,4 +448,4 @@ private class TriggerBaseTest { return super.getDmlRows(); } } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerRecord.cls b/trigger-actions-framework/main/default/classes/TriggerRecord.cls index fff6e45..5733709 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecord.cls +++ b/trigger-actions-framework/main/default/classes/TriggerRecord.cls @@ -28,4 +28,4 @@ global abstract class TriggerRecord { * @description The previous version of the SObject that triggered the current execution context. */ global SObject oldSobject; -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls index f111235..a8aca7b 100644 --- a/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls +++ b/trigger-actions-framework/main/default/classes/TriggerRecordTest.cls @@ -34,4 +34,4 @@ private class TriggerRecordTest { private class AccountTriggerRecord extends TriggerRecord { } -} +} \ No newline at end of file diff --git a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls index 1353a32..7992d0c 100644 --- a/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls +++ b/trigger-actions-framework/main/default/classes/TriggerTestUtility.cls @@ -35,9 +35,8 @@ public class TriggerTestUtility { */ public static Id getFakeId(Schema.SObjectType sObjectType) { String result = String.valueOf(myNumber++); - return (Id) (sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED) - .getKeyPrefix() + + return (Id) (sObjectType.getDescribe(SObjectDescribeOptions.DEFERRED).getKeyPrefix() + '0'.repeat(12 - result.length()) + result); } -} +} \ No newline at end of file From 46646d27f30c858bec7e51eb567bb971666c6a14 Mon Sep 17 00:00:00 2001 From: David Schach Date: Thu, 20 Mar 2025 16:00:24 -0700 Subject: [PATCH 12/16] remove list views --- .../listViews/All.listView-meta.xml | 11 ----------- .../listViews/All.listView-meta.xml | 10 ---------- 2 files changed, 21 deletions(-) delete mode 100644 trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml delete mode 100644 trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml diff --git a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml b/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml deleted file mode 100644 index 09d016d..0000000 --- a/trigger-actions-framework/main/default/objects/Trigger_Action__mdt/listViews/All.listView-meta.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - All - MasterLabel - DeveloperName - Apex_Class_Name__c - Flow_Name__c - Order__c - Everything - - diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml deleted file mode 100644 index 987b9ff..0000000 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/listViews/All.listView-meta.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - All - MasterLabel - DeveloperName - Object_API_Name__c - Object_Namespace__c - Everything - - From 4d02a0980520f49321464fd05bfd8063204218b7 Mon Sep 17 00:00:00 2001 From: David Schach Date: Fri, 21 Mar 2025 08:03:32 -0700 Subject: [PATCH 13/16] field manageability reversion --- .../fields/TriggerRecord_Class_Name__c.field-meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml index 9421bae..86b83d2 100644 --- a/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml +++ b/trigger-actions-framework/main/default/objects/sObject_Trigger_Setting__mdt/fields/TriggerRecord_Class_Name__c.field-meta.xml @@ -5,7 +5,7 @@ and `recordPrior`. Both of these variables need to match the SObject type for this SObject Trigger Setting record. false - DeveloperControlled + SubscriberControlled 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. From 0eb0b05a1e2efc63aef00a8a8525729ef8acc987 Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Tue, 8 Apr 2025 17:12:32 -0700 Subject: [PATCH 14/16] remove comment --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4758921..e8071b6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,7 +20,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: "lts/*" - #cache: "npm" - name: Install Salesforce CLI + Scanner run: | From 1cf8e43671c0780d7d3674bee5e95a33762d8f98 Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:59:32 -0700 Subject: [PATCH 15/16] remove unnecessary filter --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e8071b6..ae7188f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -29,7 +29,6 @@ jobs: sf plugins install @salesforce/sfdx-scanner - name: Run SFDX Scanner - Report findings as comments - if: github.event_name == 'pull_request' uses: mitchspano/sfdx-scan-pull-request@v0.1.16 with: severity-threshold: 4 From 8ae56afbbffcdd9152910b35cf4740630b41d5ff Mon Sep 17 00:00:00 2001 From: David Schach <636977+dschach@users.noreply.github.com> Date: Sun, 27 Apr 2025 15:50:33 -0700 Subject: [PATCH 16/16] Update .prettierrc --- .prettierrc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.prettierrc b/.prettierrc index 08737ee..e846e6b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -18,10 +18,6 @@ "files": "*.{cls,trigger}", "options": { "parser": "apex", "tabWidth": 2, "useTabs": true } }, - { - "files": "*.trigger", - "options": { "printWidth": 200 } - }, { "files": "*.{cmp,page,component}", "options": { @@ -51,14 +47,6 @@ "xmlSelfClosingSpace": true } }, - { - "files": ["**/pmd/*.xml", "*ruleset*.xml", "config/**/*.xml"], - "options": { - "parser": "xml", - "xmlSelfClosingSpace": true, - "xmlWhitespaceSensitivity": "ignore" - } - }, { "files": "*meta.xml", "options": {