Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
A 5-Step Framework to Tackling Your 
First Trigger With Confidence 
(a play in 5 acts) 
Veronica Beck 
@Twitter Handle 
As...
Safe Harbor 
Safe harbor statement under the Private Securities Litigation Reform Act of 1995: 
This presentation may cont...
Overview
Cast
Ashima Saigal 
is the founder of Database Sherpa. She is a 
certified Salesforce Administrator, Force.com 
Developer & Sum...
Veronica Beck 
is a certified Force.com Developer, and a 
consultant with Bigger Boat Consulting in 
Seattle.
Setting 
Running time is exactly 40 minutes with no intermission 
The setting: a nonprofit yoga studio that offers teacher...
Audience Participation 
We have some suggestions: 
● Breathe! You can do it. 
● Replace trepidation with curiosity. 
● Kno...
Triggers with Confidence 
Act 1: Set up Your Environment 
Act 2: Gather Your Resources 
Act 3: Clarify Your Requirements 
...
Act 1: Set up Your Environment (Where do I write 
code??) 
Developer Org: https://developer.salesforce.com/gettingstarted
Act 1: Where do I write code?? (continued)
Act 1: Where do I write code?? (continued) 
Once you have an org, either a free Developer org or a 
sandbox, navigate to t...
Act 1: Where do I write code?? (continued) 
Click the New button, and voila!
Act 2: Help! (Gather your resources) 
Salesforce coding lessons for the 99%: http://www.sfdc99.com/ 
Power of Us HUB (nonp...
Act 3: Clarify Requirements 
● What problem are you trying to solve? 
o Inconsistent campaign member statuses 
● What need...
Act 3: Clarify Requirements (continued) 
Write it “In English” (aka pseudo code): 
When a campaign is inserted 
● Check if...
Act 4: Dive in! Code and Test 
● Recap 
o Know where to code, set up your environment 
o Go through some tutorials, gather...
Act 4: Dive in! Code and Test (continued)
Act 4: Dive in! Code and Test (continued)
Act 4: Dive in! Code and Test (continued)
Act 4: Dive in! Code and Test (continued) 
When a campaign is inserted 
● If it is a workshop campaign 
● Get rid of the d...
Act 4: Dive in! Code and Test (continued)
Act 4: Dive in! Code and Test (continued)
Act 4: Dive in! Code and Test (continued)
Act 4: Dive in! Code and Test (Summary) 
● Common design elements 
o Loop through trigger.new (or trigger.old) 
o Use coll...
Act 5: Finalize and Launch 
● More testing - ask users to test 
● Revise again 
● Are you ready to go live? 
o Test covera...
That’s a Wrap 
Applause with standing ovation 
Encore Encore Encore
Resources 
Beginner Tutorial - http://www.sfdc99.com/beginner-tutorials/ 
Salesforce Developer Forum - https://developer.s...
Triggers for Admins: A Five-step Framework for Creating Triggers
Upcoming SlideShare
Loading in …5
×

Triggers for Admins: A Five-step Framework for Creating Triggers

565 views

Published on

Have you felt intimidated by the thought of writing code? Are you an experienced Salesforce Administrator and would like to take the leap into writing your own Apex triggers? Join us to gain the tools and confidence to write your first trigger. Using specific examples and real-life scenarios, we'll walk through a concrete framework to approach the process of planning, designing, and coding a trigger.

Published in: Technology
  • Be the first to comment

Triggers for Admins: A Five-step Framework for Creating Triggers

  1. 1. A 5-Step Framework to Tackling Your First Trigger With Confidence (a play in 5 acts) Veronica Beck @Twitter Handle Ashima Saigal @gandhilover
  2. 2. Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  3. 3. Overview
  4. 4. Cast
  5. 5. Ashima Saigal is the founder of Database Sherpa. She is a certified Salesforce Administrator, Force.com Developer & Summer 2014 MVP.
  6. 6. Veronica Beck is a certified Force.com Developer, and a consultant with Bigger Boat Consulting in Seattle.
  7. 7. Setting Running time is exactly 40 minutes with no intermission The setting: a nonprofit yoga studio that offers teacher trainings and workshops. They track their trainings as campaigns, with the people they invite and who attend as campaign members. Campaign member statuses they use are "Invited; Accepted; Attended; No Show. As an aside, they also use campaigns to track their fundraising events and mailings. Director: Ashima Saigal Writer/Producer: Veronica Beck Grip: Salesforce.com
  8. 8. Audience Participation We have some suggestions: ● Breathe! You can do it. ● Replace trepidation with curiosity. ● Know this won’t happen overnight. ● Remember, you are not alone.
  9. 9. Triggers with Confidence Act 1: Set up Your Environment Act 2: Gather Your Resources Act 3: Clarify Your Requirements Act 4: Code and Test Act 5: Finalize and Launch!
  10. 10. Act 1: Set up Your Environment (Where do I write code??) Developer Org: https://developer.salesforce.com/gettingstarted
  11. 11. Act 1: Where do I write code?? (continued)
  12. 12. Act 1: Where do I write code?? (continued) Once you have an org, either a free Developer org or a sandbox, navigate to the Trigger area of the object you want to write the trigger on.
  13. 13. Act 1: Where do I write code?? (continued) Click the New button, and voila!
  14. 14. Act 2: Help! (Gather your resources) Salesforce coding lessons for the 99%: http://www.sfdc99.com/ Power of Us HUB (nonprofits): http://www.salesforcefoundation.org/help/power-of-us-hub/ Success Community: (Salesforce online community) Local User Groups (in person meetings) Developer User Groups (in person meetings) Network at Dreamforce!
  15. 15. Act 3: Clarify Requirements ● What problem are you trying to solve? o Inconsistent campaign member statuses ● What needs to happen? o Auto creation of desired member statuses ● When does it need to happen? o When a new campaign is created ● Should it always happen for all records? o Only for workshop type campaigns
  16. 16. Act 3: Clarify Requirements (continued) Write it “In English” (aka pseudo code): When a campaign is inserted ● Check if it’s a workshop campaign ● If it is a workshop campaign … o Get rid of the default Campaign Statuses o Add the following campaign statuses:  Invited (default)  Accepted (responded)  Attended (responded)  No Show
  17. 17. Act 4: Dive in! Code and Test ● Recap o Know where to code, set up your environment o Go through some tutorials, gather resources o Clarify what you’re trying to do ● Search for code, copy and paste!
  18. 18. Act 4: Dive in! Code and Test (continued)
  19. 19. Act 4: Dive in! Code and Test (continued)
  20. 20. Act 4: Dive in! Code and Test (continued)
  21. 21. Act 4: Dive in! Code and Test (continued) When a campaign is inserted ● If it is a workshop campaign ● Get rid of the default Campaign Statuses ● Add the following campaign statuses: o Invited (default) o Accepted (responded) o Attended (responded) o No Show
  22. 22. Act 4: Dive in! Code and Test (continued)
  23. 23. Act 4: Dive in! Code and Test (continued)
  24. 24. Act 4: Dive in! Code and Test (continued)
  25. 25. Act 4: Dive in! Code and Test (Summary) ● Common design elements o Loop through trigger.new (or trigger.old) o Use collections to hold records to process o Do inserts, updates, and deletes outside of your loops ● Other helpful Tips o Comment your code! o Use system.debug for troubleshooting
  26. 26. Act 5: Finalize and Launch ● More testing - ask users to test ● Revise again ● Are you ready to go live? o Test coverage and test classes o Deploy errors, keep trying. Get help.
  27. 27. That’s a Wrap Applause with standing ovation Encore Encore Encore
  28. 28. Resources Beginner Tutorial - http://www.sfdc99.com/beginner-tutorials/ Salesforce Developer Forum - https://developer.salesforce.com/forums/ Trigger Best Practices - http://www.iterativelogic.com/salesforce-apex-trigger-best-practices/ Trigger Order of Execution - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execu tion.htm Writing Bulk Triggers - http://blog.jeffdouglas.com/2009/04/20/writing-bulk-triggers-for-salesforce/ Force.com Apex Developer Guide - http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm

×