When you create a new Registered Object or Routing Rule, you are required to add an Apex Class. An Apex Class is separated into two parts - a .trigger file and a Domain Class. These components cannot be created through the UI and must be injected via the Developer Console.

You must create a .trigger file before you create your Domain Class. See the Before You Begin section of Using Registered Objects for more information.

Domain Class

The Domain Class allows you to override specific default actions in your Fonteva app. Fonteva allows you to extend methods to a variety of actions in Salesforce.

You can create a new Domain Class by injecting the following code structure into the appropriate Apex Class.

EventPage Domain Class

global with sharing class EventPages extends Framework.Domain {

    public EventPages(List<Event_Page__c> sObjectList) {
        super(sObjectList);
    }

    global class Constructor implements Framework.Domain.DomainConstructor  {
        global Framework.Domain construct(List<SObject> sObjectList) {
            return new EventPages(sObjectList);
        }
    }

    public override void applyDefaults() {
        Framework.Log.push(EventPages.class.getName(),'applyDefaults');
        Framework.Log.pop();
    }

    public override void beforeDelete() {
        Framework.Log.push(EventPages.class.getName(),'beforeDelete');
        Framework.Log.pop();
    }
}
JS


Your Domain Class must always be a Global Class

While there is no strictly enforced naming convention for your Domain Class, Fonteva strongly recommends using the plural SObject name. For example, the above SObject is Event_Page__c, and the Domain Class is EventPages.

After the Public Constructor is added, the Global Class Constructor is added. This implements the Domain Constructor, which includes the sObject name (e.g.: Event_Page__c). You then enter the necessary overrides.

In the above example, the Domain Class will override applyDefaults and beforeDelete.

Domain Classes can be used to override the following methods:

 global virtual void applyDefaults() { }
    global virtual void validate() { }
    global virtual void validate(Map<Id,SObject> existingRecords) { }
    global virtual void beforeInsert() { }
    global virtual void beforeUpdate(Map<Id,SObject> existingRecords) { }
    global virtual void beforeDelete() { }
    global virtual void afterInsert() { }
    global virtual void afterUpdate(Map<Id,SObject> existingRecords) { }
    global virtual void afterDelete() { } 
JAVA