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.
Coding The Cloud with Apex
and Visualforce
Programmatic Elevate Workshop
Samantha Ready - Developer
Evangelist
@samantha_r...
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contai...
Welcome!
WIFI Connection
SSID: Elevate
PWD: salesforce1
What we want to accomplish today
 Jumpstart Programmatic Development on
Force.com
 Learn how to use the Apex Language
 ...
What should know already
 Some exposure to Salesforce1 Platform
– Beginner workshop is a great preparation (but not
requi...
The Salesforce1 Customer Platform
Salesforce1 Platform APIs
Salesforce1 App
Salesforce1 Platform Services
Force.com Heroku...
Over 1.5 Million Registered Developers
102 Developer User Groups
Salesforce1 Platform
Salesforce is a Platform Company. Period.
-Alex Williams, TechCrunch
1BAPI Calls
Per Day
6BLines of A...
Consider Becoming a Certified Developer
Brief Overview of the App So Far
 Warehousing app
– Tracks inventory
– Checks for valid data
– Stores delivery info
 Tha...
Missed the beginner track?
Demo on Data Modeling
Workbook Preparation – Let’s do this together!
 Start with a new Developer Edition
 Install Warehouse Sample Application...
Developer Basics – Tools of the Trade
 Built in Editors
 Developer Console
 Eclipse Plugin
 Command Line Interface
 W...
Developer Console Tour
Tutorial 2
Apex Language Orientation
 It’s like Java or .Net
– Strongly typed with curly braces 
 Common primitive data types
 Fa...
This is what it looks like
Invoking Apex Code
 Can be executed directly
– Execute Anonymous
 Can be triggered by database changes
– Insert, Update,...
Apex Has Data Manipulation Built In
 Query is first class part of the language
– [Select Id, Name From Account Where Coun...
Retrieving Data Using SOQL and SOSL
 SOQL is like SQL, only one verb supported (select)
– Aggregation, grouping, and geol...
What is an sObject?
 It is a chunk of data, a kin to a record, but more
– An sObject can contain a sef of other sObjects ...
Working with sObjects
DML Demo
Implementing Triggers
 Excellent choice to enforce business logic
– Triggers fire no matter what caused the data change
...
Implementing Triggers
Let’s look at some triggers…
Implementing Triggers
Trigger Tutorial
Workbook: http://bit.ly/telaviv_guide
Unit Testing in Apex
 Built in support for testing
– Test Utility Class Annotation
– Test Method Annotation
– Test Data b...
Implementing Unit Tests
Unit Test Demo
Implementing Unit Tests
Unit Test Tutorial
Apex Batch Processing
 Governor Limits
– Various limitations around resource usage
 Asynchronous processing
– Send your ...
Implementing Apex Batch Processing
Apex Batch Processing Tutorial
Writing Your Own REST Service with Apex
 Aggregating DML
– Most REST services are very granular
 Implementing database t...
Implementing Apex Rest Services
Apex Rest Services Tutorial
Let’s Take a Break!
Lunch Break
What can you do with Visualforce?
 Framework to build custom user interfaces
 Hosted natively on Force.com
 Build strea...
Model View Controller (MVC) Pattern
Standard and
Custom Objects
Standard
Controllers and
Apex
Visualforce
Mobile Visualforce in Salesforce1
 Where can I put Visualforce Pages?
– Navigation Menu
– Publisher
– Record Homepage – M...
The Salesforce1 App
All your past investments...
Drag and drop UI
customization
Notifications
Platform
Publisher
Actions
....
Adding Visualforce to Global Navigation
Responsive VF Page
in Left Nav Demo
Visualforce – Left Nav
Visualforce tabs
in Mobile
Navigation
sforce.one object for
navigation
Adding Visualforce to Global Navigation
Global Navigation Tutorial
Adding Visualforce to Global Navigation
Directions & Check In
App Demo
Visualforce – Publisher Actions
Visualforce Pages as
Publisher Actions
(Object Specific vs Global)
JavaScript Pub-Sub libr...
Visualforce – Mobile Cards
Mobile Cards -
Visualforce Pages on
Record Detail
(VF page needs to the extend Standard
Control...
Visualforce in Salesforce1
 <apex:page docType="html-5.0" …>
 ‘Available for Salesforce Mobile apps’ flag enabled
 Deve...
Visualforce Mobile Cards and Actions in
Salesforce1
Mobile Card &
Publisher Action
Tutorial
Salesforce Canvas Overview
 Enable integration of external applications securely
within Salesforce1 from the native envir...
When might you use Canvas?
 Your data does not reside in salesforce.com
– The data is best consumed in the context of sal...
Using Canvas in Salesforce 1
Canvas Tutorial
Useful Resources
 Join a Developer User Group
– http://bit.ly/fdc-dugs
– Birmingham West Midlands - bit.ly/birminghamdug
...
Developer Force – Resources and More
Thank You
Upcoming SlideShare
Loading in …5
×

Elevate Tel Aviv

439 views

Published on

This is the deck for the programmatic track of Elevate. Elevate is a hands-on, one day training teaching new developers about foundational programmatic features of the Salesforce1 Platform.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Elevate Tel Aviv

  1. 1. Coding The Cloud with Apex and Visualforce Programmatic Elevate Workshop Samantha Ready - Developer Evangelist @samantha_ready sready@salesforce.com Dave Carroll – Developer Evangelist @dcarroll dcarroll@salesforce.com
  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. Welcome! WIFI Connection SSID: Elevate PWD: salesforce1
  4. 4. What we want to accomplish today  Jumpstart Programmatic Development on Force.com  Learn how to use the Apex Language  Understand how to use Visualforce for Salesforce1  Experience coding the cloud  Enjoy ourselves in the process
  5. 5. What should know already  Some exposure to Salesforce1 Platform – Beginner workshop is a great preparation (but not required)  Programming experience in another language – .Net or Java or Ruby or Javascript (but not required)  Web programming experience – HTML and CSS (but not required)
  6. 6. The Salesforce1 Customer Platform Salesforce1 Platform APIs Salesforce1 App Salesforce1 Platform Services Force.com Heroku ExactTarget Fuel
  7. 7. Over 1.5 Million Registered Developers
  8. 8. 102 Developer User Groups
  9. 9. Salesforce1 Platform Salesforce is a Platform Company. Period. -Alex Williams, TechCrunch 1BAPI Calls Per Day 6BLines of Apex 4M+Apps Built on the Platform 1T+Records Processed per Month
  10. 10. Consider Becoming a Certified Developer
  11. 11. Brief Overview of the App So Far  Warehousing app – Tracks inventory – Checks for valid data – Stores delivery info  That’s the data model there >>
  12. 12. Missed the beginner track? Demo on Data Modeling
  13. 13. Workbook Preparation – Let’s do this together!  Start with a new Developer Edition  Install Warehouse Sample Application  Try out the Salesforce1 Browser App  Install the Salesforce1 Mobile App – Search Salesforce1 in Apple App Store or in Google Play Store Tutorial 1
  14. 14. Developer Basics – Tools of the Trade  Built in Editors  Developer Console  Eclipse Plugin  Command Line Interface  Workbench  Third Party Tools
  15. 15. Developer Console Tour Tutorial 2
  16. 16. Apex Language Orientation  It’s like Java or .Net – Strongly typed with curly braces   Common primitive data types  Familiar collections and logic constructs  Classes and Interfaces and Inheritance  Familiar polymorphic exception handling
  17. 17. This is what it looks like
  18. 18. Invoking Apex Code  Can be executed directly – Execute Anonymous  Can be triggered by database changes – Insert, Update, Delete, before and after triggers  Can be directly called through REST – Custom Apex Rest Service  Invoked as the controller portion of a Visualforce page
  19. 19. Apex Has Data Manipulation Built In  Query is first class part of the language – [Select Id, Name From Account Where Country = ‘UK’]  Insert, update, delete and upsert  Full database transaction control – SetSavePoint and Rollback  Operates on sets of or single sObjects
  20. 20. Retrieving Data Using SOQL and SOSL  SOQL is like SQL, only one verb supported (select) – Aggregation, grouping, and geolocation are all supported – Relationship navigation, sub queries and anti joins are supported  SOSL is for searching for data across columns and tables – Full text search and polymorphic results across objects – Supports abstract search field specification • Find “5559993344” in Phone Fields
  21. 21. What is an sObject?  It is a chunk of data, a kin to a record, but more – An sObject can contain a sef of other sObjects (child records) – All stored data is represented as an sObject – They all have a universally unique Id (kind of like a foreign key)  Automatically available through a REST endpoint  Can have computed fields (we call them formula fields)
  22. 22. Working with sObjects DML Demo
  23. 23. Implementing Triggers  Excellent choice to enforce business logic – Triggers fire no matter what caused the data change  Triggers operate in bulk – You should assume that more than one record is part of the execution scope  Consider the use of Asynchronous options – Calling out to a web service, cascading changes to many different objects
  24. 24. Implementing Triggers Let’s look at some triggers…
  25. 25. Implementing Triggers Trigger Tutorial Workbook: http://bit.ly/telaviv_guide
  26. 26. Unit Testing in Apex  Built in support for testing – Test Utility Class Annotation – Test Method Annotation – Test Data build up and tear down  Unit test coverage is required – Must have at least 75% of code covered  Why is it required?
  27. 27. Implementing Unit Tests Unit Test Demo
  28. 28. Implementing Unit Tests Unit Test Tutorial
  29. 29. Apex Batch Processing  Governor Limits – Various limitations around resource usage  Asynchronous processing – Send your job to a queue and we promise to run it  Can be scheduled to run later – Kind of like a chron job
  30. 30. Implementing Apex Batch Processing Apex Batch Processing Tutorial
  31. 31. Writing Your Own REST Service with Apex  Aggregating DML – Most REST services are very granular  Implementing database transactions in REST – Enforce you business logic at the data layer  Common “servlet” model – Annotations to specify POST, GET, PATCH, DELETE  You control the URL Mapping for the resource
  32. 32. Implementing Apex Rest Services Apex Rest Services Tutorial
  33. 33. Let’s Take a Break! Lunch Break
  34. 34. What can you do with Visualforce?  Framework to build custom user interfaces  Hosted natively on Force.com  Build streamlined UX  Create internal and public facing pages  Customize for different devices  Leverage other web technologies
  35. 35. Model View Controller (MVC) Pattern Standard and Custom Objects Standard Controllers and Apex Visualforce
  36. 36. Mobile Visualforce in Salesforce1  Where can I put Visualforce Pages? – Navigation Menu – Publisher – Record Homepage – Mobile Cards  Build UI with ‘Mobile Ready’ techniques (responsive, CSS, etc)  Navigation: sforce.one object – Ex: sforce.one.navigateToRelatedList(relatedListId, parentRecordId)
  37. 37. The Salesforce1 App All your past investments... Drag and drop UI customization Notifications Platform Publisher Actions ...now in the future Download Salesforce1 App today All Your Customizations All Your Devices All Your CRM All Your Apps https://yourinstance.salesforce.com/one/one.app
  38. 38. Adding Visualforce to Global Navigation Responsive VF Page in Left Nav Demo
  39. 39. Visualforce – Left Nav Visualforce tabs in Mobile Navigation sforce.one object for navigation
  40. 40. Adding Visualforce to Global Navigation Global Navigation Tutorial
  41. 41. Adding Visualforce to Global Navigation Directions & Check In App Demo
  42. 42. Visualforce – Publisher Actions Visualforce Pages as Publisher Actions (Object Specific vs Global) JavaScript Pub-Sub library available to interact with the publisher publisher.setValidForSubmit publisher.post publisher.close
  43. 43. Visualforce – Mobile Cards Mobile Cards - Visualforce Pages on Record Detail (VF page needs to the extend Standard Controller)
  44. 44. Visualforce in Salesforce1  <apex:page docType="html-5.0" …>  ‘Available for Salesforce Mobile apps’ flag enabled  Developers are responsible for making the VF page ‘mobile ready’ • Use a Responsive Design framework like Bootstrap or Mobile Design templates • Leverage touch and swipe events where appropriate  Use JavaScript Remoting/VF Remote Objects for better performance  Use HTML5 for device features like Geolocation and Camera access
  45. 45. Visualforce Mobile Cards and Actions in Salesforce1 Mobile Card & Publisher Action Tutorial
  46. 46. Salesforce Canvas Overview  Enable integration of external applications securely within Salesforce1 from the native environment – Javascript API, Secure Authentication, Context Services, X- Domain API, Eventing Model, App Registration and Management
  47. 47. When might you use Canvas?  Your data does not reside in salesforce.com – The data is best consumed in the context of salesforce, but is not required to reside there  You have developers focused on other technologies – Sometimes Salesforce1 developers are hard to find   You have an existing application – Don’t need to reinvent the wheel
  48. 48. Using Canvas in Salesforce 1 Canvas Tutorial
  49. 49. Useful Resources  Join a Developer User Group – http://bit.ly/fdc-dugs – Birmingham West Midlands - bit.ly/birminghamdug – London – bit.ly/londondug – Bristol – bit.ly/bristoldug – Dublin – bit.ly/dublindug  Become a Developer User Group Leader – Email: April Nassi anassi@salesforce.com
  50. 50. Developer Force – Resources and More
  51. 51. Thank You

×