Your SlideShare is downloading. ×
0
Introduction to Apex TriggersArming the DangerousIman Maghroori, Lead Sales Engineer@IMaghrooriJosh Kaplan, Senior Product...
Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contai...
Iman MaghrooriLead Sales Engineer@IMaghroori
Josh KaplanSenior Product Manager@JoshSFDC
Here is the Plan     What is a     Trigger?   When / Why       TriggerDeconstruction         Tools    Resources         Q&A
SURVEY: RAISE YOUR HAND IF YOU’VE…   Created a Custom Field?   Created a Workflow/Approval rules?   Written any code be...
What is a Trigger?
What is a Trigger?            “…is procedural code that is            automatically executed in response            to cer...
What is a Trigger?          “ …custom code that fires          when a record is created,          updated or deleted.”    ...
What Happens When You Hit “Save”?
What Happens When You Hit “Save”?1.    Old values are overwritten2.    System Validation Rules3.    Apex (before) triggers...
Now You’re Dangerous…
When Should You Use Triggers?• When all other options fail• Don’t write code if you don’t have to   • Easier to maintain  ...
Workflow Can…•   Update Fields•   Assign Tasks•   Send Emails•   Send Outbound Messages (Integrations)
Workflow Cannot…•   Create Other Records – Automatically create child records.•   Complex Calculations – Calculate total r...
Apex: The Programming Language of Force.com Object-oriented language Java-like syntax 2.5 Billion Lines Of Apex
Why Apex?            Runs in the Cloud            Integrated to Your Data            Convenience Features            Testi...
The Force.com Platform is a Multi-Tenant Environment
Use Case: UberJet
Create Invoice Trigger
Reserve Jet Trigger
User Email Trigger
Workflow Can…•   Update Fields•   Assign Tasks•   Send Emails•   Send Outbound                    Test Your Code!
75% Minimum Code Coverage Before You DeployWe check for the %, you should check for all the possible use cases.
How to Deploy to Production?•   Make sure your code passes the tests & test coverage•   Create an “Outbound Change Set” an...
Next Steps to Level Up  • Developer Environment  • Apex Workbook  • To Learn More
Where Can I Go for Help?  •   Developer.force.com  •   Salesforce.com Training / Certifications  •   Code Share  •   Devel...
Any Questions?
Introduction to Apex Triggers
Introduction to Apex Triggers
Introduction to Apex Triggers
Introduction to Apex Triggers
Upcoming SlideShare
Loading in...5
×

Introduction to Apex Triggers

692

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
692
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
88
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction to Apex Triggers"

  1. 1. Introduction to Apex TriggersArming the DangerousIman Maghroori, Lead Sales Engineer@IMaghrooriJosh Kaplan, Senior Product Manager@JoshSFDC
  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 intellectual property and other litigation, risks associated with 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-Q for the most recent fiscal quarter ended July 31, 2012. This 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. Iman MaghrooriLead Sales Engineer@IMaghroori
  4. 4. Josh KaplanSenior Product Manager@JoshSFDC
  5. 5. Here is the Plan What is a Trigger? When / Why TriggerDeconstruction Tools Resources Q&A
  6. 6. SURVEY: RAISE YOUR HAND IF YOU’VE… Created a Custom Field? Created a Workflow/Approval rules? Written any code before? Written Apex code? Written a Trigger before?
  7. 7. What is a Trigger?
  8. 8. What is a Trigger? “…is procedural code that is automatically executed in response to certain events in a database…” - Wikipedia
  9. 9. What is a Trigger? “ …custom code that fires when a record is created, updated or deleted.” -Iman Maghroori
  10. 10. What Happens When You Hit “Save”?
  11. 11. What Happens When You Hit “Save”?1. Old values are overwritten2. System Validation Rules3. Apex (before) triggers4. Custom Validation Rules5. Record saved to DB (not committed)6. Record reloaded from DB7. Apex (after) triggers8. Assignment Rules9. Auto-Response Rules10. Workflow Rules11. Escalation Rules12. Rollup Summary Formulas updated13. Database Commit14. Post-commit logic (Sending emails)
  12. 12. Now You’re Dangerous…
  13. 13. When Should You Use Triggers?• When all other options fail• Don’t write code if you don’t have to • Easier to maintain • Easier to change • Faster to deploy
  14. 14. Workflow Can…• Update Fields• Assign Tasks• Send Emails• Send Outbound Messages (Integrations)
  15. 15. Workflow Cannot…• Create Other Records – Automatically create child records.• Complex Calculations – Calculate total revenue from child accounts• Automatically Submit Records for Approval• Delete Records
  16. 16. Apex: The Programming Language of Force.com Object-oriented language Java-like syntax 2.5 Billion Lines Of Apex
  17. 17. Why Apex? Runs in the Cloud Integrated to Your Data Convenience Features Testing Framework Backward Compatibility
  18. 18. The Force.com Platform is a Multi-Tenant Environment
  19. 19. Use Case: UberJet
  20. 20. Create Invoice Trigger
  21. 21. Reserve Jet Trigger
  22. 22. User Email Trigger
  23. 23. Workflow Can…• Update Fields• Assign Tasks• Send Emails• Send Outbound Test Your Code!
  24. 24. 75% Minimum Code Coverage Before You DeployWe check for the %, you should check for all the possible use cases.
  25. 25. How to Deploy to Production?• Make sure your code passes the tests & test coverage• Create an “Outbound Change Set” and add your updates to it• Push the Outbound Change Set to your Production Environment• Accept the Inbound Change Set in your Production Environment.• Setup->Deploy->Inbound Change Sets -> [Change Set] -> Deploy
  26. 26. Next Steps to Level Up • Developer Environment • Apex Workbook • To Learn More
  27. 27. Where Can I Go for Help? • Developer.force.com • Salesforce.com Training / Certifications • Code Share • Developer Community • Apex Guide • Help & Training Take it to the Next Level: Professional Services
  28. 28. Any Questions?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×