Important setup for newly cloned sandbox and test classes
This article outlines the important data to be set up for:
- a new developer sandbox.
- developing any customization that requires test classes.
New sandbox
When a new developer sandbox is cloned from production, it only contains the setup data like custom settings and custom metadata type. The required custom object data like Trigger Handler is not included.
In order to make RIO Education work in the new sandbox, you would need to execute the following script in the developer console:
rio_ed.REDU_PostInstallation pi = new rio_ed.REDU_PostInstallation(); //setup the RIO Education settings upsert pi.initRIOEdSettings(rio_ed__RIO_Education_Settings__c.getOrgDefaults()); //setup EDA Hierarchy settings upsert pi.updateEDASettings(); // Get the TDTM tokens of the existing HEDA TDTM configs: List<hed.TDTM_Global_API.TdtmToken> allTokens = hed.TDTM_Global_API.getTdtmConfig(); // Create all HEDA trigger handlers: hed.TDTM_Global_API.setTdtmConfig(allTokens, 'hed'); //disable EDA trigger handlers that replaced by RIO Education update pi.disableEDATriggerHandlers(); //create all RIO Education related trigger handlers pi.createAllTriggerHandlers(); //create a default resource type rio_ed__Resource_Type__c rType = new rio_ed__Resource_Type__c(); rType.Name = 'Location'; insert rType; |
Test class
In a test class with seeAllData=false, you would need to setup the RIO Education data in the @TestSetup method:
@TestSetup static void makeData(){ rio_ed.REDU_PostInstallation pi = new rio_ed.REDU_PostInstallation(); //setup the RIO Education settings upsert pi.initRIOEdSettings(rio_ed__RIO_Education_Settings__c.getOrgDefaults()); //setup EDA Hierarchy settings upsert pi.updateEDASettings(); // Get the TDTM tokens of the existing HEDA TDTM configs: List<hed.TDTM_Global_API.TdtmToken> allTokens = hed.TDTM_Global_API.getTdtmConfig(); // Create all HEDA trigger handlers: hed.TDTM_Global_API.setTdtmConfig(allTokens, 'hed'); //disable EDA trigger handlers that replaced by RIO Education update pi.disableEDATriggerHandlers(); //create all RIO Education related trigger handlers pi.createAllTriggerHandlers(); //create a default resource type rio_ed__Resource_Type__c rType = new rio_ed__Resource_Type__c(); rType.Name = 'Location'; insert rType; } |