Author name: Himanshu

Mark Opportunity as Hot for High Amounts

This trigger updates the Opportunity Description to “Hot Opportunity” if the Amount is greater than 100,000. It helps identify key opportunities for follow-up. For practice, explore this YouTube playlist. Solution: trigger OpportunityTrigger on Opportunity (before insert) {            if(Trigger.isInsert){                    if(Trigger.isBefore){      […]

Mark Opportunity as Hot for High Amounts Read More »

Update Contacts When Parent Account’s Industry Changes

Using asynchronous Apex, this trigger updates related Contacts when an Account’s Industry field changes to “Biotechnology.” It ensures synchronization across records. Practice similar scenarios via this YouTube playlist. Solution:trigger AccountTrigger on Account (before insert, before update, after update,         after insert, after undelete){         if(Trigger.isAfter && Trigger.isInsert) {     

Update Contacts When Parent Account’s Industry Changes Read More »

Populate Rating as Hot for Media Accounts

When an Account is created and its Industry is set to “Media,” this trigger automatically sets the Rating to “Hot,” enforcing specific business logic for such accounts. Learn more through this YouTube playlist. Solution:trigger AccountTrigger on Account (before insert) {           if(Trigger.isInsert){ if(Trigger.isBefore){                   

Populate Rating as Hot for Media Accounts Read More »

Copy Billing Address to Shipping Address

If the “CopyBillingToShipping” checkbox is selected, this trigger copies the Account’s billing address to its shipping address. It automates address management for consistency. Practice triggers here: YouTube playlist. Solution: trigger AccountTrigger on Account (before insert) {              if(Trigger.isInsert){ if(Trigger.isBefore){                   AccountTriggerHandler.updateRating(Trigger.New);     

Copy Billing Address to Shipping Address Read More »

Create Related Opportunity on Account Creation

This trigger creates a new Opportunity with default values whenever an Account is created, automating Opportunity setup for new Accounts. For similar examples, visit this YouTube playlist. Solution: trigger AccountTrigger on Account (after insert) {               if(Trigger.isInsert){ if(Trigger.isAfter){                       

Create Related Opportunity on Account Creation Read More »

Create Related Contact on Account Creation

When a new Account is created, this trigger automatically generates a related Contact record, reducing manual effort and ensuring consistency between records. Explore this concept further here: YouTube playlist. Solution: trigger AccountTrigger on Account (after insert) {                if(Trigger.isInsert){ if(Trigger.isAfter){                  AccountTriggerHandler.createContact(Trigger.New); 

Create Related Contact on Account Creation Read More »

Update Latest Case Number on Account

When a new Case is created for an Account, this trigger updates the Account’s “Latest Case Number” field with the newly created Case’s number. Practice similar triggers here: YouTube playlist. Solution: trigger CaseTrigger on Case (after insert) {         if(Trigger.isInsert){ if(Trigger.isAfter){             CaseTriggerHandler.populateLatestCaseNum(Trigger.New);           

Update Latest Case Number on Account Read More »

Create Contact or Opportunity Based on Checkbox

When an Account is created, this trigger checks for custom checkboxes to determine if a related Contact or Opportunity should be created. Opportunities are only created if the Account is marked “Active.” For more hands-on practice, check out this YouTube playlist. Solution: trigger AccountTrigger on Account (after insert) {             if(Trigger.isInsert){

Create Contact or Opportunity Based on Checkbox Read More »

Populate Recent Opportunity Amount on Account

This trigger updates an Account’s “Recent Opportunity Amount” field with the amount of the most recently created Opportunity linked to it. It ensures accounts always reflect the latest Opportunity values. Practice similar triggers through this YouTube playlist. Solution: trigger OpportunityTrigger on Opportunity (after insert) {             if(Trigger.isInsert){ if(Trigger.isAfter){     

Populate Recent Opportunity Amount on Account Read More »

Shopping Cart

Let's get you started!

Interested in writing Salesforce Content?

Fill in this form and we will get in touch with you :)