Your SlideShare is downloading. ×
Elevate Tel Aviv
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Elevate Tel Aviv

250
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.

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

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
250
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Big Green button. Create a couple fields. Relate things.
  • Eclipse plugin install link:
  • A trigger is a piece of code that executes before or after records of a particular type are inserted, updated, or deleted from the Force.com platform database. Every trigger runs with a set of context variables that provide access to the records that caused the trigger to fire. All triggers run in bulk; that is, they process several records at once.



    Triggers can also modify other records of the same type as the records that initially fired the trigger. For example, if a trigger fires after an update of contact A, the trigger can also modify contacts B, C, and D. Because triggers can cause other records to change, and because these changes can, in turn, fire more triggers, the Apex runtime engine considers all such operations a single unit of work and sets limits on the number of operations that can be performed to prevent infinite recursion.



    Use the future annotation to identify methods that are executed asynchronously. When you specify future, the method executes when Salesforce has available resources.

    For example, you can use the future annotation when making an asynchronous Web service callout to an external service. Without the annotation, the Web service callout is made from the same thread that is executing the Apexcode, and no additional processing can occur until the callout is complete (synchronous processing).

  • TestInvoiceStatementDeletion GIST  https://gist.github.com/dcarroll/9609640
    TestDataFactory  https://gist.github.com/dcarroll/9609573
  • TestInvoiceStatementDeletion GIST  https://gist.github.com/dcarroll/9609640
    TestDataFactory  https://gist.github.com/dcarroll/9609573
  • TestCleanUpBatchClass  https://gist.github.com/dcarroll/9609978
    CleanUpRecords  https://gist.github.com/dcarroll/9609997
    CreateMerchandiseData  https://gist.github.com/dcarroll/9610037
    MyScheduler  https://gist.github.com/dcarroll/9610109

    Execute Anonymous:
    CreateMerchandiseData.GenerateMerchandiseData();
    MyScheduler.RunInOneMinute();
  • 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
  • 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
  • Use the docType=”html-5.0” attribute in the <apex:page> tag to define the structure of the rendered page. If html-5.0 is specified, you can utilize HTML5 browser features like tags, JavaScript APIs (like drag and drop, local storage, and geolocation), and the useful Visualforce features as well.  This will also relax the default HTML tidying in Visualforce for HTML5 applications.

    When building a custom style mobile page, set standardStylesheets=”false” on the <apex:page> tag to eliminate any conflicts with any the standard Salesforce stylesheets are added to the generated page header if the showHeader attribute is set to false. Use the applyHtmlTag and applyBodyTag attributes of the <apex:page> tag to suppress the automatic generation of <html> and <body> tags, in favor of static markup you add to the page yourself.

    Pass thru
    You can add arbitrary attributes to many Visualforce components that will be “passed through” to the rendered HTML. This is useful, for example, when using Visualforce with JavaScript frameworks, such as jQuery Mobile, AngularJS, and Knockout, which use data-* or other attributes as hooks to activate framework functions. It can also be used to improve usability with HTML5 features such as placeholder “ghost” text, pattern client-side validation, and title help text attributes.

    Input:
    Set the type attribute on input components to display UI widgets that help users enter data. Each input adapts for the type of data expected: text fields show a keyboard, date fields show a date picker, etc. For example:


    Sforce.one:
    The Salesforce1 Platform includes a strict event mechanism for navigation.  This is exposed in Visualforce as a JavaScript object called sforce.one.  It’s available in any Visualforce page that appears in Salesforce1.
  • A couple of things that you should do to make your Visualforce pages work well in the salesforce1 app.

    Always use the doctype attribute on your page tag. This provides access to the most current features of HTML from your javascript code.

    There is a check box on the metadata detail page for your Visualforce pages that needs to be checked. If for some reason your page is not showing, double check that you have made it available for salesforce mobile apps.

    You need to style your pages appropriately for the device you are targeting. Responsive design CSS and JS are great ways to target multiple devices with one code base.

  • Transcript

    • 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. 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. Welcome! WIFI Connection SSID: Elevate PWD: salesforce1
    • 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. 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. The Salesforce1 Customer Platform Salesforce1 Platform APIs Salesforce1 App Salesforce1 Platform Services Force.com Heroku ExactTarget Fuel
    • 7. Over 1.5 Million Registered Developers
    • 8. 102 Developer User Groups
    • 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. Consider Becoming a Certified Developer
    • 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. Missed the beginner track? Demo on Data Modeling
    • 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. Developer Basics – Tools of the Trade  Built in Editors  Developer Console  Eclipse Plugin  Command Line Interface  Workbench  Third Party Tools
    • 15. Developer Console Tour Tutorial 2
    • 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. This is what it looks like
    • 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. 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. 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. 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. Working with sObjects DML Demo
    • 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. Implementing Triggers Let’s look at some triggers…
    • 25. Implementing Triggers Trigger Tutorial Workbook: http://bit.ly/telaviv_guide
    • 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. Implementing Unit Tests Unit Test Demo
    • 28. Implementing Unit Tests Unit Test Tutorial
    • 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. Implementing Apex Batch Processing Apex Batch Processing Tutorial
    • 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. Implementing Apex Rest Services Apex Rest Services Tutorial
    • 33. Let’s Take a Break! Lunch Break
    • 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. Model View Controller (MVC) Pattern Standard and Custom Objects Standard Controllers and Apex Visualforce
    • 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. 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. Adding Visualforce to Global Navigation Responsive VF Page in Left Nav Demo
    • 39. Visualforce – Left Nav Visualforce tabs in Mobile Navigation sforce.one object for navigation
    • 40. Adding Visualforce to Global Navigation Global Navigation Tutorial
    • 41. Adding Visualforce to Global Navigation Directions & Check In App Demo
    • 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. Visualforce – Mobile Cards Mobile Cards - Visualforce Pages on Record Detail (VF page needs to the extend Standard Controller)
    • 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. Visualforce Mobile Cards and Actions in Salesforce1 Mobile Card & Publisher Action Tutorial
    • 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. 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. Using Canvas in Salesforce 1 Canvas Tutorial
    • 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. Developer Force – Resources and More
    • 51. Thank You

    ×