Giter Club home page Giter Club logo

change-data-capture's Introduction

change-data-capture

Custom Salesforce Change Data Capture solution leveraging Platform Events that allows for Whitelisting fields which trigger events

Includes an example for how to invoke the change data capture framework from Account trigger handler.

Supports three major event types: Full Data Capture, Diff Data Capture, and Delete Data Capture.

Full Data Capture

This event type will capture all whitelisted fields for a Record. Common use cases included: After Insert events & Resyncing Events

Example Invocations:

new FullDataCapture(newMap, new ChangeDataCaptureType().captureInsert())
    .createEvents();
new FullDataCapture(
            new Map<Id,SObject>{ recordId => new ResyncSelector().selectRecord(recordId) },
            new ChangeDataCaptureType().captureResync()
        ).createEvents();

Note: SF Apex does not support enums with reserved keywords as values. The ChangeDataCaptureType() class is a common workaround for this Enum limitation.

Diff Data Capture

This event type will capture only the whitelisted fields which have changed. Common use case: After Update events

Example Invocation:

new DiffDataCaptureFromIsActive(oldMap, newMap).createEvents();

This particular example uses a subclass of the DiffDataCapture super-class which takes into account if a Record is active or not

Delete Data Capture

This event type will capture metadata about the record (including: record Id, deletion datetime, etc.), but does not include any other whitelisted field information. Common use case: ... you get the idea :)

new DeleteDataCapture(oldMap).createEvents();

change-data-capture's People

Contributors

cgjerow avatar

Stargazers

 avatar Francisco Saravia avatar Marco Trova avatar

Watchers

 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.