Author name: Himanshu

Set Hot Rating for Media Industry Accounts

This trigger updates an Account’s Rating to “Hot” whenever its Industry field is set to “Media,” whether during creation or updates. For additional examples, explore this YouTube playlist. Solution: trigger AccountTrigger on Account (before update) {             if(Trigger.isUpdate){ if(Trigger.isBefore){                  AccountTriggerHandler.updateIndustryRating(Trigger.New, Trigger.oldMap);   

Set Hot Rating for Media Industry Accounts Read More »

Copy Billing to Shipping Address on Update

Solution: If the “CopyBillingToShipping” checkbox is selected, this trigger ensures that any update to the billing address is mirrored in the shipping address for consistency. Practice more scenarios like this with this YouTube playlist. trigger AccountTrigger on Account (before update) {          if(Trigger.isUpdate){ if(Trigger.isBefore){         AccountTriggerHandler.copyBillToShip(Trigger.New,         Trigger.oldMap); 

Copy Billing to Shipping Address on Update Read More »

Update Opportunity Description Based on Stage

This trigger updates an Opportunity’s Description to indicate its status: “Opp is Closed Lost,” “Opp is Closed Won,” or “Opp is Open,” based on its Stage. Learn more about triggers here: YouTube playlist. Solution: trigger OpportunityTrigger on Opportunity (before update) {                if(Trigger.isUpdate){ if(Trigger.isBefore){           

Update Opportunity Description Based on Stage Read More »

Sync Contact Mailing Address with Account Billing

This trigger updates the Mailing Address of all Contacts when an Account’s Billing Address is modified, ensuring data consistency. Learn about similar automation here: YouTube playlist. Solution: trigger AccountTrigger on Account (after update) {           if(Trigger.isUpdate){ if(Trigger.isAfter){                               

Sync Contact Mailing Address with Account Billing Read More »

Update Contacts’ Phone via Parent-Child SOQL

Using Parent-Child SOQL queries, this trigger updates all related Contacts’ Home Phone fields when an Account’s Phone field changes. Explore more scenarios via this YouTube playlist. Solution: trigger AccountTrigger on Account (after update) {         if(Trigger.isUpdate){ if(Trigger.isAfter){                               

Update Contacts’ Phone via Parent-Child SOQL Read More »

Update Contacts’ Mailing Address via SOQL

Using Parent-Child SOQL, this trigger copies changes in an Account’s Billing Address to the Mailing Address of all related Contacts. Practice similar triggers here: YouTube playlist. Solution: trigger AccountTrigger on Account (after update) {         if(Trigger.isUpdate){ if(Trigger.isAfter){                                 

Update Contacts’ Mailing Address via SOQL Read More »

Create Task on Opportunity Stage Change

This trigger generates a Task record whenever an Opportunity’s Stage changes. The Task is assigned to the logged-in user, Opportunity Owner, or another designated user. For more hands-on examples, check this YouTube playlist. Solution: trigger OpportunityTrigger on Opportunity (after update) {          if(Trigger.isUpdate){ if(Trigger.isAfter){                 

Create Task on Opportunity Stage Change Read More »

34. Prevent account record from being edited if the record is created 7 days back.

Solution: trigger AccountTrigger on Account (before update) {        if(Trigger.isUpdate){ if(Trigger.isBefore){                                       AccountTriggerHandle.preventAccEdit(Trigger.new);                         }         }}public class AccountTriggerHandle{ public static void     

34. Prevent account record from being edited if the record is created 7 days back. 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 :)