→ Apex Trigger 1 Develop an Apex Trigger so that every time any account is inserted then set the value of the Industry field to Education. Also, check if the Description is blank then set the value for the description field to “Account Description is blank”
Industry = Education
Description = Account Description is blankif Description is null
Hands on
//logic less trigger
trigger AccountTrigger on Account(before insert){AccountTriggerDispatcher.dispatch(Trigger.operationType);}
Dispatcher Class
// dispatcher classpublicclassAccountTriggerDispatcher{publicStaticvoiddispatch(System.TriggerOperation operationType){switch on operationType{
WHEN BEFORE_INSERT{AccountTriggerHandler.beforeInsert(trigger.new);}}}}
Handler Class
//Handler classpublicwithsharingclassAccountTriggerHandler{publicStaticvoidbeforeInsert(ListaccountList){for(Account acc : accountList){if(acc.Industry==Null){acc.Industry='Education';}if(acc.Description==Null){acc.Description='Account Description is blank';}}}}
The Salesforce CLI is not just a tool; it’s the cornerstone of development on the Salesforce Platform. It’s your go-to for building, testing, deploying, and more. As one of the most important development tools in our ecosystem
Table of Contents
What is Apex Log Analyzer?
Apex Log Analyzer, a tool designed with Salesforce developers in mind, is here to simplify and accelerate your...
Introduction
Hey Everyone,
Welcome to my podcast, the first-ever podcast in India for Salesforce professionals.
Achievement
We are happy to announce that we have been selected as Top...