Skip to content

A comprehensive, metadata-driven trigger framework for Salesforce that provides a flexible architecture for managing trigger logic with custom metadata configuration, bypass controls, and async execution support.

Notifications You must be signed in to change notification settings

haribaskarvr/salesforce-trigger-framework

Repository files navigation

Trigger Framework Package

This package contains a comprehensive Trigger Actions Framework for Salesforce.

Package Structure

This project follows the Salesforce DX source format with a standard manifest package structure:

trigger-framework-package/
├── sfdx-project.json          # SFDX project configuration
├── .forceignore               # Files to ignore during deployment
├── manifest/
│   └── package.xml            # Package manifest
└── force-app/
    └── main/
        └── default/
            ├── classes/       # Apex classes
            ├── triggers/      # Apex triggers
            ├── objects/       # Custom objects and metadata
            └── layouts/       # Page layouts

Components Included

Core Framework Classes

  • ITriggerHandler - Interface for trigger handlers
  • TriggerContext - Context information for triggers
  • TriggerHandler - Base trigger handler class
  • AsyncTriggerHandler - Async trigger handler
  • TriggerHandlerUtils - Utility methods
  • TriggerHandlerConstants - Framework constants
  • TriggerBypassManager - Bypass management

Example Implementation

  • Example_AccountTriggerHandler - Example handler implementation
  • AccountTrigger - Example trigger

Custom Metadata Types

  • Trigger_Handler_Config__mdt - Handler configuration
  • Trigger_Action__mdt - Action configuration

Custom Settings

  • Trigger_Bypass__c - Bypass settings

Deployment Options

Option 1: Deploy using Manifest (package.xml)

sf project deploy start --manifest manifest/package.xml

Option 2: Deploy entire source

sf project deploy start --source-dir force-app

Option 3: Deploy to scratch org

sf org create scratch --definition-file config/project-scratch-def.json --alias trigger-framework
sf project deploy start --source-dir force-app

Validation

Validate before deploying:

sf project deploy validate --manifest manifest/package.xml

Running Tests

Run all tests:

sf apex test run --test-level RunLocalTests --result-format human

API Version

This package uses API version 65.0.

About

A comprehensive, metadata-driven trigger framework for Salesforce that provides a flexible architecture for managing trigger logic with custom metadata configuration, bypass controls, and async execution support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published