Giter VIP home page Giter VIP logo

lightweight-trigger-framework's Introduction

Lightweight-Trigger-Framework

A lightweight trigger handler framework for Salesforce Apex.

Complex Apex trigger frameworks getting you down? This is a very lightweight trigger framework to get you started.

Full details and implementation steps can be found on my blog at http://chrisaldridge.com.

How to implement this trigger pattern

  1. Copy the ITriggerHandler and TriggerDispatcher classes into your org (in that order). Or you can use the Deploy To Salesforce link below.
  2. Create an objectTriggerHandler class (such as OpportunityTriggerHandler), which implements the ITriggerHandler interface. Have a look at the AccountTriggerHandler class in this repository for a working example.
  3. Add logic for the methods you require. For example, if you want some BeforeInsert logic, add it to the BeforeInsert method in your handler class.
  4. Create a trigger for your object which fires on all events. If you're using MavensMate/Sublime Text, there is a template for this when you create a new trigger. Take a look at the example AccountTrigger in this repository if you're not sure.
  5. Call the static TriggerDispatcher.Run method from your trigger. Pass it a new instance of your TriggerHandler class as an argument
  6. Take a tea break. You've earned it.

Deploy To Salesforce

Clicking the below link will install the classes straight into your Salesforce org. Thanks to Andrew Fawcett for the magic tool that does this.
Deploy to Salesforce

Licence

This project is licensed under the terms of the MIT license.

lightweight-trigger-framework's People

Contributors

chrisaldridge avatar

Watchers

EdGuz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.