Posts

50 Salesforce Apex trigger scenarios categorized by complexity to help you practice coding real-world business logic

  Beginner Scenarios (Basic Automation & Validations) Lead Automation : Automatically set the Rating to "Hot" whenever a new Lead is created with an Industry of "Technology". Account Phone Cascade : Update the Phone field on all related Contacts whenever the parent Account’s Phone is modified. Prevent Deletion : Restrict users from deleting an Opportunity if its StageName is already set to "Closed Won". Task Creation : Automatically create a follow-up Task for the Account owner whenever a new Account of type "Prospect" is created. Contact Greeting : Set a custom Description text (e.g., "Hello [FirstName]") on a Contact record right before it is inserted. Case Priority : Automatically upgrade a Case Priority to "High" if the subject contains the word "Urgent" or "Critical". Opportunity Defaulting : Set the CloseDate to exactly 30 days from today whenever a new Opportunity is created without one. ...