Salesforce coding lessons for the 99%
Finally, Apex tutorials for point-and-click admins! Written by a self-taught Google engineer.
  • Beginner Tutorials
    • Apex
    • Certifications
    • Career Info
    • Technical Architect
    • Visualforce
    • Videos
  • Apex Academy
  • Success Stories
  • About Me
  • Misc
    • Mailbag
    • Challenges
    • Links
    • Login to my Org
Follow @dvdkliuor SUBSCRIBE!

Webinar Code Examples: Get Started with Apex in 30 Minutes

May 11, 2014

Here’s the code we’re using in the Get Started with Apex in 30 Minutes webinar!

We’re creating a trigger that simply creates a new Case when an Account is created!

Trigger

trigger TShirts on Account (after insert) {
    for (Account acc : Trigger.new) {
Case shirtCase = new Case(); shirtCase.Subject = 'Send them a free T-shirt!'; shirtCase.Priority = 'Ultra High'; shirtCase.AccountId = acc.Id;
insert shirtCase;
} }

Test Class

@isTest
public class TestTShirts {
    static testMethod void accountCreator() {
Account acc = new Account(); acc.Name = 'Tesla Motors';
insert acc;
} }

Additional resources:

  • See this code live: login to Sfdc99’s Salesforce instance!
  • Learn more about triggers: how to write, test, and deploy your first trigger!
  • Learn Apex by Summer’s end: Step-by-step guide to learning Apex this Summer!
  • Watch: the entire webinar recording!

Don’t forget to sign up for the next two webinars in the series!

  • May 22nd – Build on the Basics
  • May 29th – Beyond the Basics

I hope you’re enjoying this series! I got nothing but love for you guys!
2 Comments
Vijay
May 15, 2014 @ 1:34 pm

Thanks David and LeeAnne for your insights this morning – it was an encouraging and informational webinar!

Reply
    David Liu
    May 15, 2014 @ 2:21 pm

    Thank you Vijay!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


*

*

Theme: Simple Style by Fimply