Introduction

The Registered Objects page provides options to monitor and manage objects that have been registered with Spark Framework in your environment. By default, ALL Fonteva Objects are registered in Spark. However, additional apps or custom objects can be registered manually. Registering objects ensures the structural code required to support API functions is correctly installed and ready for use. It also means that Spark will track exceptions or errors through System Logs, run rollup summary fields, and execute custom triggers on all managed objects. 

Related documentation:
For more technical information on Registered Objects, please refer to the Using Registered Objects section of Fonteva's Developer Documentation.

For information on deploy objects created in a sandbox, please read the Deploy Enhancements from Sandboxes guide from Salesforce.

To navigate to Registered Objets, click Objects from the Dashboard

The  Registered Objects page features include:

  • Create a new object

  • Enable/Disable objects

  • Enable/Disable triggers

  • Disable validations

Register a New Object

After creating a new object, it must be registered. Follow the below three steps to register your new object. The object must first be installed in the system before it can be registered.

Domain Class (Apex Class) is needed for every object you want to register. We've provided the necessary code below to create the Apex Class for the object you want to register.

Step 1 - Create an Apex Class for the Object:

Domain Class Code:

Apex Class Code
global class PLURAL_OBJECT_NAME extends Framework.Domain {

    public PLURAL_OBJECT_NAME(List<OBJECT_API_NAME> sObjectList) {
        super(sObjectList);
    }

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

  1. Click the Lightning Gear icon and select Developer Console. The Developer Console will open in a new window.


  2. From the Developer Console, click File to expand the file menu, then click New and select Apex Class. This will open the New Apex class window.


  3. In the New Apex class window, enter a name for the new Apex Class using the following naming convention:

    1. Use the plural of the object name you are registering. 

    2. Do not use underlines in lieu of spaces; instead, use camel case (capitalize the first letter of each word) for legibility.

  4. Click OK.

  5. The Developer Console will now display the newly created Apex Class tab with default code lines displayed. 

  6. Select and delete the default code listed, as we will replace this code with the Domain Class Code listed above.

  7. Copy & paste the Domain Class Code into the Developer Console window. Disregard any problem listed regarding the OBJECT-API_NAME as we will change the code in the following steps.

  8. In the code lines, replace all instances of the text PLURAL_OBJECT_NAME with the Plural Name of the Object your are registering. For example, if your Object name = Grant, the Plural Name = Grants. 

  9. Replace the OBJECT_API_NAME text with the API name of the Object you are registering. Make sure it is entered in between the <> . Example: Grant__c  

  10. Click File and click Save.

Step 2 - Create a Trigger for the Object:

All objects in Fonteva’s product have a trigger included. This is used by Spark’s routing rules to extend the functionality. All registered objects will need a similar trigger created. 

Trigger Code
trigger OBJECT_NAMETrigger on OBJECT_API_NAME (before insert, before update, before delete,
                                   after insert, after update, after delete) {
    Framework.Dispatcher.dispatchTrigger();
}
JAVA

  1. Click File to expand the file menu, then click New and select Apex Trigger. This will open the New Apex Trigger window.



  2. In New Apex Trigger window, type a name a name for the Apex Trigger. We recommend using the following naming convention: Name of ObjectTrigger. Example: Object Name = Grant so the Apex Trigger = GrantsTrigger.

  3. Select the Object from the sObject pick list. Example: Object Name = Grant

  4. Click Submit in the New Apex Trigger window.

  5. The Developer Console will now display the newly created "Apex Trigger" tab with default code lines displayed. 

  6. Select & delete the default code listed. We will replace this code with the Apex Trigger Code listed above.

  7. Copy & paste the Apex Trigger Code into the Developer Console window.

  8. In the code lines, replace all instances of the text OBJECT_NAME with the Name of the Object your are registering. Example: GrantTrigger

  9. Replace the OBJECT_API_NAME text with the API name of the Object you are registering. Example: Grant__c  

  10. Click File and click Save.

Step 3- Register Object in Spark:

Once the Domain Class (Apex Class) and a Trigger (Apex Trigger) are created for the object you wish to register, the next step is to return to Spark and register the object from the Registered Objects page.

  1. From the Registered Objects page, click the + New Object button. This opens the New Registered Object window.


  2. In the Name picklist, select the name of the object you're registering.

  3. In the Namespace field, type a name if the object is part of another managed package or type N/A if it is custom object created directly in the environment.

  4. In the Apex Class field, type a Namespace. If the object is part of an installed package, type the Domain (Apex class) created in Step 1 above. Example: Grants

  5. Optional fieldsSOQL Limit and SOQL Order By are configurations you can set for when you use the Framework selector. It is a Utility class leveraged by developers that allows you to query objects in your code. The data returned is based on what you put in these fields. If you enter nothing in the SOQL Limit, it will default to 2000. If you enter nothing in the SOQL Order By field, it will default to Name ASC (for ascending).

  6. Check the Is Enabled checkbox. This activates the newly registered object to use all Framework code functionality, such as Triggers and Rollup Summaries. If Is Enabled isn't checked, the object won’t show in Rollup Summaries, and Triggers won't fire.

  7. Check the Triggers Enabled checkbox. This activates the trigger on the newly registered object. If properly used, it will allow the user to activate and deactivate triggers on that particular object in a production environment without a deploy. If you uncheck Triggers Enabled, Triggers and Routing Rules will be disabled at the code level. This supersedes any setting on the Routing Rules page.

  8. Verify Validation Disabled checkbox is UNCHECKED. Otherwise, checking this field disables validations in the domain class of the object. It is recommended to keep this field unchecked. Each domain class has validation methods for after update and before insert. However, you can disable if necessary. This is most commonly done when loading data. You can only disable one object at a time so you won’t disrupt overall usage of the system.

  9. Click Save.

  10. The newly registered object will display in the list of Registered Objects.

Enable or Disable Objects, Triggers, and Validations for Registered Objects:

  1. On the Registered Objects page, click the Arrow button in the Action column for the object you desire.

  2. In the Menu dropdown, click Edit. The Edit Registered Object window will open.

  3. From the Edit Register Object window, scroll to bottom of the window to the pictured checkboxes. 


  4. Next to the Is EnabledTriggers Enabled, and Validation Disabled checkboxes, either check or uncheck the desired boxed as needed. Before enabling triggers on a registered object, specify the Apex Class in the Registered Object Settings. If Is Enabled isn't checked, the object won’t show in Rollup Summaries, and Triggers won't fire. If you uncheck Triggers Enabled, Triggers and Routing Rules will be disabled at the code level. This supersedes any setting on the Routing Rules page. It is recommended to keep the Validation Disabled field unchecked. Each domain class has validation methods for after update and before insert. However, you can disable if necessary. This is most commonly done when loading data. You can only disable one object at a time so you won’t disrupt overall usage of the system.

  5. Click Save. Your changes will be applied.