The System.TriggerOperation enum has the following values:
BEFORE_INSERE
AFTER_INSERT
BEFORE_UPDATE
AFTER_UPDATE
BEFORE_DELETE
AFTER_DELETE
AFTER_UNDELETE
The new Trigger context variable Trigger.operationType will return System.TriggerOperation enum during trigger context.
If you combine this new context variable and the new Apex switch feature, trigger code becomes much easy to implement and understand.
Sample Switch and enum in Triggers:
trigger AccountTrigger on Account(before insert, after insert, before update, after update, before delete, after delete, after undelete) {
switch on Trigger.operationType {
when BEFORE_INSERT {
//Invoke before insert trigger handler
system.debug('Before Insert');
}
when AFTER_INSERT {
//Invoke after insert trigger handler
system.debug('After Insert');
}
when BEFORE_UPDATE {
//Invoke before update trigger handler
system.debug('Before Update');
}
when AFTER_UPDATE {
//Invoke after update trigger handler
system.debug('After Update');
}
when BEFORE_DELETE {
//Invoke before delete trigger handler
system.debug('Before Delete');
}
when AFTER_DELETE {
//Invoke after delete trigger handler
system.debug('After Delete');
}
when AFTER_UNDELETE {
//Invoke after undelete trigger handler
system.debug('After Undelete');
}
}
}
Lightning Object Creator is a new tool to create custom object from spreadsheets with just a few clicks.
Step 1:
Go to Setup | Object Manager | Select Custom Object from Spreadsheet
Step 2:
Upload spreadsheets from Microsoft Excel, Google Sheets, or comma-separated value (CSV) files.
Sample Spreadsheet:
Step 3:
After uploading the spreadsheet, Salesforce will automatically detect the fields. You can customize the Salesforce field name and field data type and you also can add field to page layout.
Step 4:
Define object properties and click on Finish button.