Alert! Event Notification Options for Apps Webinar


Published on

Event notification is an important part of most business applications. When something important happens, you sometimes need one or more users to take a specific action. This intermediate- to advanced- level webinar teaches you all about event notification, contrasts the different Salesforce features you can use to implement it, and shows you practical examples of how to use those Salesforce features to suit your specific event notification use case.

Key Takeaways
:: Understand how use case requirements help you determine the appropriate feature to use for event notification.
:: Implement and contrast event notification with Visualforce pages that poll, Visualforce pages that use the Streaming API, workflow rules, Chatter feeds and scheduled reports.

Intended Audience
:: This intermediate-level webinar is geared towards application developers and architects.

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Alert! Event Notification Options for Apps Webinar

  1. 1. Alert! Event Notification Options for Apps October 16, 2013
  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, 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 products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of, 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., inc. assumes no obligation and does not intend to update these forward-looking statements. #forcewebinar
  3. 3. Speakers Steve Bobrowski Architect Evangelist @sbob909 #forcewebinar Josh Birk Developer Evangelist @JoshBirk
  4. 4. Follow Developer Force for the Latest News @forcedotcom / #forcewebinar Developer Force – Community +DeveloperForce – Community Developer Force Developer Force Group #forcewebinar
  5. 5. Architect Core Resources page #forcewebinar
  6. 6. Have Questions? §  We have an expert support team at the ready to answer your questions during the webinar. §  Ask your questions via the GoToWebinar Questions Pane. §  The speaker(s) will chose top questions to answer live at the end of the webinar. §  Please post your questions as we go along! §  Only post your question once; we’ll get to it as we go down the list. #forcewebinar
  7. 7. Recognize this scenario in life? Something happens #forcewebinar Call to action Someone or thing acts
  8. 8. Recognize this scenario in life? Leaky pipes #forcewebinar Call plumber Plumber fixes the pipes
  9. 9. Recognize this scenario in business? Event #forcewebinar Notification Workflow
  10. 10. Recognize this scenario in business? New Lead created #forcewebinar Salesperson gets alert Salesperson calls Lead and makes a sale
  11. 11. Optimal event notification design for business apps Know your … Requirements Options Use an option that meets your requirements #forcewebinar
  12. 12. Hot, Open Leads Scenario Requirements Implementation options §  Notify both online & offline users §  Workflow rule §  Notify users immediately §  Database trigger with email §  Log all alerts §  Respond to all alerts #forcewebinar §  Chatter feed with email
  13. 13. Stick around, here’s what you’ll learn … Requirements Approaches & implementation options Demos & source code #forcewebinar
  14. 14. Let’s get started … #forcewebinar
  15. 15. Know your requirements
  16. 16. Event importance can dictate requirements How important is an event? Critical Insignificant #forcewebinar
  17. 17. Event Notification Requirements: Importance Requirement Minimal Latency Accountability Response #forcewebinar Critical Yes Yes Yes Insignificant No No No
  18. 18. Event frequency can dictate requirements How often does an event occur? Frequent Infrequent #forcewebinar
  19. 19. Event Notification Requirements: Frequency Requirement Minimal Latency Accountability Response #forcewebinar Frequent No No No Infrequent Yes Yes Yes
  20. 20. Requirements graph example Determinant Determinant Requirement Immediate notification Critical Infrequent Log Mandatory response #forcewebinar
  21. 21. Requirements example Determinant Determinant Requirement Deferred notification Insignificant Frequent No log Optional response #forcewebinar
  22. 22. Requirements graph example Determinant Determinant Requirement Immediate notification Critical Frequent Log Optional response #forcewebinar
  23. 23. Know your requirements
  24. 24. event notification requirements Determinants Requirements •  Importance •  Frequency •  Latency •  Accountability •  Resolution #forcewebinar
  25. 25. Improv + Discovery = Satisfied Customers How improvistational theatre techniques can improve your discovery skills T.K. Horeis,, Cloud and Industry Architect @TKHoreis Steve Bobrowski,, @sbob909
  26. 26. Know your options
  27. 27. event notification approaches & options Dynamic Web pages #forcewebinar Near real-time messages Deferred messages
  28. 28. event notification approaches & options Dynamic Web pages #forcewebinar Near real-time messages Deferred messages
  29. 29. Dynamic, auto-refreshing Web page Characteristics §  Teams of users are online & watching §  Missed events tolerated §  Refreshes happen often §  Receipt of event notification not required Stock ticker #forcewebinar
  30. 30. Dynamic, auto-refreshing Web page implementation options Auto-refreshing … §  Visualforce page §  Report (browser plugin) §  List view (browser plugin) #forcewebinar
  31. 31. event notification approaches & options Dynamic Web pages #forcewebinar Near real-time messages Deferred messages
  32. 32. Near real-time messages Characteristics §  Users cannot always be online watching pages §  Near real-time notification §  Missed events not tolerable §  Proof of individual event notification required §  Relatively few events, low noise #forcewebinar Messages Events
  33. 33. Near real-time messages implementation options §  Workflow rule –  Email –  Outbound message Messages §  Chatter feed with email §  Chatter feed trigger Events #forcewebinar
  34. 34. event notification approaches & options Dynamic Web pages #forcewebinar Near real-time messages Deferred messages
  35. 35. Deferred messages Requirements §  Users cannot always be online watching pages §  Deferred (significantly) event notifications tolerated Message §  Missed events tolerable §  Receipt of individual event notification not required §  Data set is potentially large §  Potentially many events #forcewebinar Events
  36. 36. Deferred messages implementation options §  Scheduled reports Message Events #forcewebinar
  37. 37. event notification approaches & options Dynamic Web pages Near real-time messages Deferred messages •  Visualforce pages •  Reports •  List views •  Workflow rules •  Chatter feed email •  Chatter feed trigger •  Scheduled reports #forcewebinar
  38. 38. Enough theory …
  39. 39. Show me how!
  40. 40. Demos: Hot, Open Leads, every which way Workflow rule Dynamic Visualforce page Scheduled report #forcewebinar
  41. 41. Implementation 1: Dynamic Web page Visualforce page
  42. 42. The Observer Pattern: Push vs. Pull Update Lead push pull (polling) #forcewebinar
  43. 43. Implementation 1a: Polling with Apex actionPoller Visualforce page With <apex:actionPoller> #forcewebinar Controller (Apex) database
  44. 44. Implementation 1a: Page <apex:page showHeader=”true" controller=”leadListController" tabstyle="lead" sidebar="false">
 <apex:form >
 <apex:pageBlock >
 <apex:pageBlockTable id="leadList" value=”{!leads}" var="l">
 <apex:column headerValue="Name">
 <apex:outputLink value="/{!}">{!l.Name}</apex:outputLink>
 <apex:column value="{!l.state}"/>
 <apex:column value="{!}"/>
 <apex:column value="{!}"/>
 <apex:actionPoller action=”{!pollAction}" reRender="leadList" interval="15"/>
 </apex:page> #forcewebinar
  45. 45. Implementation 1a: Controller public with sharing class leadListController {
 Transient Lead[] leads;
 String query = 'SELECT Id, Name, State, Company, Email, LastModifiedDate FROM Lead WHERE Status = 'Open - Not Contacted' AND Rating = 'Hot' ORDER BY LastModifiedDate DESC LIMIT 100';
 public Lead[] getLeads() {
 leads = Database.query(query);
 return leads;
 public PageReference pollAction() {
 leads = Database.query(query);
 return null;
 } #forcewebinar
  46. 46. Traditional polling implementation: Pros & cons Pros Cons §  Easy §  Wasteful §  Partial page refresh §  Consumptive §  WHERE clause in query §  View state §  Transient controller variable §  No API calls #forcewebinar
  47. 47. Implementation 1b: Streaming API Push topic database #forcewebinar push Visualforce page “subscriber” to the push topic
  48. 48. Streaming API factoids §  Push on CREATE or UPDATE §  Push topic queries cannot: –  Use relationships (join data) –  Aggregate data (SUM, AVG, etc.) –  Reference formula fields –  Other limitations #forcewebinar
  49. 49. Implementation 1b: Streaming API Insert Update Delete Lead #forcewebinar trigger Push topic HOL__c Visualforce page “subscriber” to the push topic
  50. 50. Implementation 1b: Intermediary object #forcewebinar
  51. 51. Implementation 1b: Push topic PushTopic pushTopic = new PushTopic();
 pushTopic.Name = 'HOL';
 pushTopic.Query = 'SELECT Id, Name, Action__c, Lead_Name__c, Company__c, State__c, Email__c, Lead__c FROM Hot_Open_Lead__c'; 
 pushTopic.ApiVersion = 28.0;
 pushTopic.NotifyForOperations = 'All';
 pushTopic.NotifyForFields = 'Referenced';
 insert pushTopic; #forcewebinar
  52. 52. Implementation 1b: Controller @RemoteAction
 static public Lead[] getHotLeads() {
 String query = 'SELECT Id, Name, State, Company, Email, LastModifiedDate FROM Lead WHERE Status = 'Open - Not Contacted' AND Rating = 'Hot' ORDER BY LastModifiedDate DESC';
 Lead[] leads = Database.query(query);
 return leads;
 } #forcewebinar
  53. 53. Implementation 1b: Static Resources <apex:includeScript value="{!$Resource.cometd}"/>
 <apex:includeScript value="{!$Resource.jquery}"/>
 <apex:includeScript value="{!$Resource.json2}"/>
 <apex:includeScript value="{!$Resource.jquery_cometd}"/>
 <apex:includeScript value="{!URLFOR($Resource.jquery_ui,'/ jquery-ui-1.10.3/ui/jquery-ui.js')}"/>
 <apex:includeScript value="{!$Resource.underscore}"/> #forcewebinar
  54. 54. Implementation 1b: Load Initial Table var template = $("#holList").html();
 leadListController.getHotLeads(function(res,mes) {
 hotLeads = res;
 }); #forcewebinar
  55. 55. Implementation 1b: Script Template <tbody>
 </tbody> // repeat items 
 <tr id="lead-<%= item.Id %>" class="dataRow">
 <!-- use variables -->
 <td><a href="/<%= item.Id %>"><%= item.Name %></a></td>
 <td><%= item.State %></td>
 <td><%= item.Company %></td>
 <td><%= item.Email %></td> 
  56. 56. Implementation 1b: Respond to Streaming API // Connect to the CometD endpoint
 url: window.location.protocol+'//'+window.location.hostname+'/ cometd/24.0/',
 requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}
 // Subscribe to the push topic
 $.cometd.subscribe('/topic/HOL', function(message) {
 }); #forcewebinar
  57. 57. Live demo
  58. 58. Long polling implementation: Pros & cons Pros Cons §  Minimal page refreshes §  Requires some code §  Partial page refreshes §  Complex use cases require some thought §  No view state §  Easy on the database §  Centralized logic §  Overcomes Streaming API challenges #forcewebinar
  59. 59. Implementation 2: Near-real time messaging Workflow rule Messages Events
  60. 60. Live demo
  61. 61. Workflow rule: Pros & cons Pros Cons §  No code §  Could get noisy §  Near real-time messages §  Accountability (logs) #forcewebinar
  62. 62. Implementation 3: Deferred messaging Scheduled report Message Events
  63. 63. Live demo
  64. 64. Scheduled report: Pros & cons Pros Cons §  No code §  Lag time §  No noise §  Missed events §  Accountability (logs) #forcewebinar
  65. 65. Summary
  66. 66. Source code §  Github repo: #forcewebinar
  67. 67. Article Access article link on #forcewebinar
  68. 68. Even more stuff …
  69. 69. Architect Core Resources page #forcewebinar
  70. 70. Q&A Steve Bobrowski Architect Evangelist @sbob909 #forcewebinar Josh Birk Developer Evangelist @JoshBirk