Developer week EMEA - Salesforce1 Mobile App overview


Published on

A brief introduction to the Salesforce1 Mobile App and how you can customise it to deliver a great experience for your users and customers.

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
  • This is salesforce1. Salesforce1 is comprised of all the applications that run on top of Salesforce1 Platform Services, and Salesforce1 Platform APIs and served up using the Salesforce1 Mobile App. The consolidation of the platform services combined with their APIs make up the Salesforce1 Platform. We have taken this route so that we can enable you, the developer, to create a multitude of mobile applications easily, reliably and with massive flexibility.We are here to talk about driving a mobile app revolution in the enterprise.
  • Positioning Salesforce1 mobile with respect to bespoke and native mobile development. Salesforce1 mobile app delivers the most value for employee facing (internal company) applications, requiring little or no coding.
  • “Everything” except for:Rich text fields – these could be pulled in via visualforce pagesVisualforce pages that have not been set to show up in mobile
  • Download the Salesforce1 mobile app from you devices app store is probably the easiest way to get it.
  • If you don’t have a mobile device handy you can still test out the Salesforce1 mobile app by using your desktop browser.We have found some issues with Firefox that prevent the app from running. Also found some issues with any browsers on Window 8.
  • A quick overview of the Salesforce1 mobile app – there is a little bit of terminology to learn.The next few slides will drill into each of these in a little more detail
  • By creating our custom tab we were able to have it show up in our left nav!Create a new App in setup and show it appear in the app
  • We also create a compact layout which is automatically used when the record is accessed from salesforce1! But there is a lot more we can do, even still without coding.
  • Let’s review the other parts of the salesforce1 app that we interacted with.You are going to see 5 different apps today, and I don’t expect you to remember every click. You can dig into these features in Setup and the documentation when you get started building your own app.First is List Views. Main point here is that they are the same as the ones your user has access to in the desktop application, including custom List Views they add.
  • Next is the Expanded Lookup. In the Page Layout Editor, there is a new category called Expanded Lookups, and you drag the one you want into the Mobile Card section. It will only display in Salesf orce1 Mobile, not on the Desktop app.The fields for the Expanded Lookup are defined by the Primary Compact Layout definition for the object in the lookup. So, in our case that was the Contact object. This is important because the Compact Layout also controls the fields at the top of the detail page in Salesforce1 Mobile, and you can only have 4 fields, so choose carefully.
  • One great trick is the built-in map integration for Account & Contact records. Note this is ONLY on Accounts and Contacts, not on custom objects, but it is pretty cool.
  • This last feature is the secret sauce of Salesforce1 Mobile success in your company. The thing is, like any sauce, you want to use it wisely. Not enough quick actions, Salesforce1 feels cumbersome, too many, users get overwhelmed. This is the area you want to really focus on when you are gathering requirements from your users – what are the 3-4 things they are ALWAYS doing on the road. Define those as Publisher Actions, setting Predefined Values whenever possible to save even more time, and you will be a hero.
  • 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.
  • Just to recap, we used the left nav bar to navigate to the issues list, and the issue detail page used the library to navigate to a linked case, providing that seamless integration.
  • This highlights the features we used in this app.Not sure if we’re planning to use this throughout the deck, so this is hidden.
  • Anothergreat non-code trick to use to amaze your friends is the new Twitter component for Social Contacts in Spring ’14. Follow these steps to set it up and you’re users will have easy access to their Contacts social feed right from Salesforce1 Mobile.
  • Here is an app that leverages a common feature of a lot of mobile apps, the ability to check in to a location. In this case, we are going to enable checking in when have arrived at an account for some business. Because this app is targeted at a field sales person, we have also added the ability to get driving directions.[Demo the app]To build this kind of app, we need to use a combination of declarative and programmatic platform features. First, let’s take a look at the directions part of the app. We have used a VF page and can easily leverage a mapping API to provide the users current location coordinates from her device and the coordinates of the account to request proper directions from the mapping provider.There are a couple of things I’d like to point out about this visualforce page. First, it uses a standard controller, in this case the account standard controller. This is important for providing the context that this page will run in. When designating a standard controller, you are essentially specifying that this page is appropriate for including on an Account standard layout.The rest of the page is really almost copy and paste from a sample for the Google directions API. We include a reference to the directions javascript library. We are leveraging HTML5’s geolocation feature to obtain the users current location, and then setting a destination based on the account object made available from the standard controller.Once we have this visualforce page ready to go we need to integrate into the Account details standard page layout. For salesforce1 we can do this using a mobile card. Mobile cards are only displayed from within the salesforce1 mobile app. Let’s go ahead and edit the page layout. Now, scrolling down we can find this section called “Mobile Cards”. Now, because we indicated the Account standard controller on our page, it shows up here in the group of available Visualforce pages. We can now just drag that page to the mobile card section and drop it in place and save our layout. That’s all it takes. When the detail loads, our page is passed the appropriate account object and it all just works.Now to the check in functionality. This is slightly different from the directions in that the context for this feature should be global instead of the context of a single record, like an account. First, let’s take a look at the page. In this case I have a custom controller to provide access to the Chatter API. This page is also using knockout.js to control the flow of the page. You can, of course, use any Javascript library or framework that you like. This page also is a good example of using our Mobile Template library for rapid salesforce1 app development. Finally, we are referencing our publisher.js library that provides key functionality for interacting with the salesforce1 app container.Once an account has been selected, we execute the code that publishes a notification that the submit button can now be activated. The salesforce1 app itself is subscribed to the “setValidForSubmit” notification and will do all the work of enabling the submit button for us. On the other side of the pub/sub technique, we are listening for a particular action also. In this case we are subscribed to any “” notifications. When we receive this we can make a remote action call to our custom controller to create the check in task. Finally, when that call returns, we ask salesforce1 to close our check in action.Making the check in action available to salesforce1 is very straight forward. First, we create the global action. Just select new and Visualforce action type. With the action created we can now add it to the Global Layout for the publisher. Editing the global layout gives me access to every global action in my org and allows me to add and remove and re-order all the actions that are in the publisher. All publisher actions show up as quick actions in salesforce1.This kind of app is really impactful and easy to create. Let’s review our integration points within the salesforce1 mobile app for this kind of app.
  • Imagine you're working on a product that has some or all of its code in a GitHub repository. This app integrates GitHub Issues with Cases in Salesforce. As a user, I can browse open issues assigned to me, link them to cases, and see the link on the Case record. The app does OAuth against GitHub, obtaining an access token to call the GitHub REST API and retrieve issues and comments.Preparation:You will need a GitHub account. If you do not already have one, you can sign up at . You will also need to create a repository on GitHub. If you already have a repository with issues, then great - use that; otherwise, go to and create a new repository. Create some issues in the new repository and assign them to yourself (select them in the issues screen for your repository, click 'assignee' and select yourself).You will also need to create a GitHub app specific to your org. Go to , click 'Register new application', and enter:Application Name: Issues in GithubHomepage URL: description: Link GitHub issues to Cases in Salesforce1Authorization callback URL: Replace 'instance' as appropriate for your DE org - e.g. na15.Keep the GitHub app window around - you'll need to copy Client ID and Client Secret.To install the app into a DE org, go to the GitHub repository for this project - - and click 'Install Unmanaged Packed' from there.You will need to add the app's tab to the left nav menu - go to Setup | Mobile Administration | Mobile Navigation, move 'Issues in GitHub' to the 'Selected' list, click 'Up' to move it just after 'Groups', and click 'Save'.Now add the GitHub link and publisher action to the Case Page Layout. Go to Setup | Customize | Cases | Case Layouts, and click 'Edit' next to 'Case Layout'. Drag the 'GitHub Link' field and drop it under 'Case Number' in the 'Case Information' section. Click 'Actions' in the palette, drag 'Link to GitHub Issue' and drop it in the 'Publisher Actions' between 'Post' and 'Log a Call'. Save the page layout.You will also need to create a Custom Setting record with the app's Github credentials. Go to Setup | Develop | Custom Settings, click 'Manage' next to 'GitHub App Settings' and create a new record with:Name: Github AppClient Id: copy from GitHub app windowClient Secret: copy from GitHub app windowSource code is in the GitHub repository at your DE org, pin 'Cases' to the top of the Search results - in the regular browser interface to your DE org, search for any text you like, hover over the 'Cases' entry in the 'Records' list on the left, and click the pin that appears. Cases will move to the top of the Records list. This just makes it easier to find cases during the demo.The app writes a GitHub access token to your user record. Netween demos, you will need to delete the access token to be able to show authorization with GitHub. Go to your User record in your DE org (Setup | Manage Users | Users | click your user's name), click 'Edit', then scroll down to the 'Additional Information' section and delete the GitHubAccessToken value. Hit 'Save'.Show the app on a real phone if you can (using AirServer or Reflector to show your phone's screen on your laptop). Next best is to use the iOS simulator. If you have to use your laptop browser, use Chrome and enable mobile emulation ( - this will correctly generate the touch events that Salesforce1 is expecting.Run through the demo at least a couple of times, and leave some issues linked to cases.Running through the app:In the Salesforce1 Mobile App, open the left nav menu, and select 'Issues in GitHub'. If you deleted your GitHub access token (see 'Preparation', above), you should see a login page with the GitHub logo. Touch the logo, and you will be prompted to log in to GitHub, and authorize the app to access your data. Don't worry if it skips the login page and goes straight to authorization - if you've been round this loop, the browser has your GitHub cookie - it's not important for the demo flow. Also, if you don't see the GitHub authorization screen within a few seconds, just close the window and touch the GitHub logo again - occasionally this page seems to glitch.Once you've authorized the app, you should see a list of issues from GitHub. This JavaScript single-page app, running on a Visualforce page in Salesforce1, is retrieving this data directly from GitHub, without hitting the Apex controller.Note that it will only show open issues assigned to you, so if you see an empty list of issues, go create some in GitHub and assign them to yourself (see 'Preparation', above). You can touch an issue to drill down and see more detail, including any comments posted to the issue, and any cases that the issue is linked to. You can touch a linked case to go to its record detail page - seamless integration between the app and Salesforce1.Now let's link an issue to a case. Open the left nav menu, and select 'Cases' (it should be visible at the top of the 'Recent' sub menu - if not, you'll need to pin it in the Search results - see 'Preparation', above). Select a Case, and open the publisher (plus sign on bottom right of screen). Select 'Link to GitHub Issue' and you should see a list of issues. This time, touching an issue will select it for linking to the case. A link icon will appear to indicate the selected issue. You can play around in this screen a little - the icon will move to the last touched issue, and touching the linked issue will deselect it.When you've selected an issue, touch 'Submit' at the top of the screen. You'll be taken back to the Case record, which will refresh. Swipe left to see the Case detail, and scroll down to the 'GitHub Link' field. Touch 'View GitHub Issue' and the detail page for the linked issue should appear. Notice that the linked case is listed on the issue detail. Note that, currently, the 'spinner' stays active, even though the detail page has loaded. I'm investigating why this is the case - it might be fixed by the time you run through this.Exploring the code:Due to time constraints, we'll highlight the important integration points, but the code is on GitHub for anyone to dig deeper.Start on the github_app_htmlVisualforce Page. Point out the <apex:page> attributes - we're using showHeader="false", sidebar="false", standardStylesheets="false" and applyHtmlTag="false" to get complete control over the page.The app uses AngularJS and the Ionic Framework - the CSS and JavaScript for this is loaded from static resources. AngularJS is a client-side MVC framework - it allows you to divide up your JavaScript app into modules. You can see the includes for the modules in github_app_html under the "<!-- the app's js -->" comment. You can also see where the app gets the GitHub API access token from the Visualforce Page's Apex controller, in the {!accessToken} merge field.Open that Apex controller - the GithubController class. The Apex controller reads the access token from the User record in its constructor. Notice in the 'onLoad' action method, if there is no access token, the onLoad method returns a redirect to the login page. The Visualforce Page runs this action method before it renders the page - this is what activates the GitHubOAuth login. We won't go down the OAuth rabbit hole here, but the code is all there if anyone wants to take a look.Back on the github_app_htmlVisualforce Page, scroll down to the bottom - the <ion-nav-view> element is where the app content will be rendered. This app comprises a number of views that can be dynamically loaded from templates.Open the github_app_js static resource - this is where the app is configured. Scroll down and you'll see a set of 'states' that associate a url with a template and controller, all broken down into their own static resource files. You can see the states for the issue list, issue detail, and link views.Open the github_issues_html static resource. Notice the <ion-list>, containing an <ion-item>, with an 'ng-repeat' attribute. This is very similar to a Visualforce <apex:repeat> - we're iterating through a list of issues, showing some fields from each one. Notice the link - it has a # prefix - we don't want to go to a different page to see issue detail; we want to show a different view, and the # is followed by a path, containing an encoded issue url. When the user touches the list item, that link will be followed, loading the issue detail view.Open the github_controllers_js static resource. The first controller, IssuesCtrl, simply loads all issues from the Issues service. In AngularJS, controllers simply marshall data into the template - services retrieve data.Open the github_services_js static resource. The 'all' function retrieves a list of issues from GitHub. Skip past the error handling to see where it caches the issue list, and builds a map so that issues are easily accessible to the app from their URL without going back to the GitHub API. This function uses 'promises' to simplify asynchronous programming. The function returns a promise that the caller can use to get the data later, without building a stack of callbacks.Open the github_link_js static resource. This is the publisher action for linking an issue to a case. Since it runs in the context of a Case record, it uses the Case standard controller, but we define GithubController as an extension. Scroll down and you'll see that the HTML is almost identical to github_app_html, except that we pull data from the Apex controller (the {!case.Id}, {!case.CaseNumber} and {!case.GitHub_Issue__c} merge fields) and add it to the AngularJS root scope so that it is accessible to the AngularJS controllers.A little lower down, you can see the integration with Salesforce1. We use the publisher library, activating the 'Submit' button in the 'publisher.showPanel' handler, and, when the user hits submit, we call the attachIssue method on GithubController to attach that issue to the case. Go to the GithubController class and scroll down to the attachIssue method - it's really very simple.Now look at the 'Buttons, Links & Actions' page for Case. You'll see the publisher action there. Click its 'Edit' link and you'll see the Visualforce page there. Now go to the Case 'Page Layout' and point out the action in the list of publisher actions.There are quite a few moving parts here, but the end result is a very seamless user experience. With this app in Salesforce1, the user can move between issues from GitHub and Cases from Salesforce in a very natural way.
  • Our custom publisher action allowed a context-specific operation – linking an issue to a particular case – here we used the publisher library to manage the action page lifetime
  • And, though it’s not specifically a feature of Salesforce1, adding a formula field to the Case object allowed us to navigate straight to its linked issue – another seamless integration.
  • A selection of design considerations and approaches that Salesforce recommend when building apps that will be used across all devices (web, tablet, phone, etc).
  • Focused on development specifically for the Salesforce1 Mobile App
  • A developer theatre, library, quick-starts and mini-hacksPeter Chittum & John Stevenson will be there. Possibility of talks from community members?
  • Developer library, Quick-starts and help from local developers as experts.
  • Let’s say you work for a large consumer product company, and you want to extend your marketing campaigns to include a loyalty program. Your company has millions of customers and you want to create an app that can push offers and products to them as a reward for being a great consumer of your product.Let’s take a look at an app that does exactly that.Access the following URL:[Tap Sign Up, then tap the Back button without signing up. Tap Sign In, and “Login with Facebook”]As a customer of this company, I can sign up for the loyalty program within the app and login, or I can just login with Facebook. When I sign up or login with Facebook, a Contact is automatically created in Salesforce.[Wait for Facebook login to complete]On the first screen, I can see my profile including my status (Gold, Silver, Bronze) and my point balance. Some of this information, including my profile picture was pulled directly from Facebook.[Click ‘Edit’ (upper right)]- I can change my personal information including my profile picture, and my preferences. When I click Save (upper right button), the Contact object is updated. [Click the Menu button (left side of the Header)]When I click the menu button, I can see the different options available in the app[Select Special Offers]I can select ‘Special Offers’ to see a list of offers that the company pushes to its loyal customers. These offers come from the Campaign object in Salesforce.[Optional: if you have access to the org, show the corresponding campaigns in Salesforce][Select one of the offers]- I can select an item in that list to see the details of a specific offer. In the Offer Details screen, I can:share the offer on social media (only Facebook is implemented at this time) redeem the offer, which will show a QR code that can be scanned at the cash registraror save the Offer to my Wallet to make it easy to access it at a later time . Some of these activities like ‘Share on Facebook’, or ‘Save to Wallet’ are tracked in the Interaction custom object in Salesforce[Optional: if you have access to the org, show the Intecactions in Salesforce][Go back to the menu and select Wallet]Let’s go back to the menu and select ‘Wallet’ to see the offer I just saved.[Go back to the menu and select Products]I can also select Products to see a list of new Products the company wants to share with me. This list comes from the Product2 object in Salesforce.[Optional: if you have access to the org, show the corresponding products in Salesforce][Select a product]Again, I can select a Product in the list to see the Product Details. In the Product Details screen, I can share the Product on social media or add the Product to my wish list [The Add to Wish List button is not implemented at this time][Go back to the menu and select Store Locator]The store locator option shows my position on a map, and a list of stores near me. Clicking a store in the list will center the map on the store location.[You can also tap the location pin (upper right corner) to go back to your location][Go back to the menu and select Help]The Help option lets me provide feedback or ask a question. When I click Submit, a case is automatically created in Salesforce.
  • This app leverages standard technologies and practices for building mobile web apps. Here is the architecture for building this kind of customer engagement app.The Marketing organization manages the content of the application (Campaigns and Products) in Salesforce through the browser or the Salesforce1 app. As I said before, Users of the app become Contacts in Salesforce.The consumer app runs in Heroku. It’s built in JavaScript on Node.js, but it could have been written in any other language supported by Heroku: Java, Ruby, or PHP.The Node application accesses the Salesforce data in a Postgres database running in Heroku. “Heroku Connect” is used to synchronize the data between your Salesforce org and the Postgres database. In this app, “Heroku Connect” syncs Product, Campaign, Contact and Interaction (a custom object that keeps track of the user interactions in the app: Facebook Likes, Offers saved to wallet, Offers redeemed, etc.)“Heroku Connect” provides bi-directional synchroniztion:- Products and campaigns are copied from Salesforce to Postgres- App Users are created in Heroku and pushed as contacts to Salesforce. Interactions are also pushed from Heroku to Salesforce.Heroku Connect is a great solution to access Salesforce data from a custom app. One thing to be aware of is that the data sync process is asynchronous: the sync process kicks in every 10 minutes. That is appropriate for many types of data. However, if you need immediate “real time” data, you can still use API calls. For example in this application, when a the user fills in the Help form, a Case is created in Salesforce using an API call through nforce. This may be justified by a contractual clause that guarantees a response with a certain amount of time.The client app accesses the data in Heroku using a REST API defined in the Node.js app. These are API calls to your custom app, in other words they don’t count towards your API limits.The client of the application is built with AngularJS and the Ionic framework.So in summary, we built an entirely custom application, and the Salesforce1 platform made it easy to implement the back-end and to deeply integrate with the Salesforce data and processes that are managed by the Marketing organization using the Salesforce1 app or Salesforce in the browser.
  • Backup slide: Use this slide if you want to go deeper on Heroku Connect and don’t have access to it to demonstrate live.Heroku Connect is very simple to set up:You simply map Salesforce objects to Postgres database tables. For each object, you can specify which fields to synchronize. That’s it! Heroku Connect takes care of keeping the data in sync.
  • Re-write slide
  • A developer theatre, library, quick-starts and mini-hacksPeter Chittum & John Stevenson will be there. Possibility of talks from community members?
  • Developer library, Quick-starts and help from local developers as experts.
  • Developer week EMEA - Salesforce1 Mobile App overview

    1. 1. Salesforce1 Developer Week Bringing developers around the world together to build mobile apps.
    2. 2. This is Salesforce1 platform
    3. 3. Two ways to build Mobile Apps Customer-Facing Mobile Services Custom Mobile Apps Employee-Facing Out-of-the-box AppExchange Apps: Dropbox Concur Evernote ServiceMax More Custom Apps and Integrations: SAP Oracle Everything Custom More Sales, Service and Marketing Accounts Cases Campaigns Dashboards More Salesforce1 Mobile App
    4. 4. The Salesforce1 Mobile App “Everything” you develop In your Org is accessible Via Salesforce1 mobile app
    5. 5. Download Salesforce1 Mobile App from your mobile phone app store i.e Apple Store, Google Play
    6. 6. Also viewable in a browser Use Salesforce1 mobile in your browser If you don‟t have a mobile device - Can be useful for rapid testing Note: this does not currently work in Firefox or Windows 8 browsers. Google Chrome is the recommended browser.
    7. 7. Introducing Salesforce1 Mobile App Drag and drop UI customization Notifications Publisher Actions You Saleslforce Apps Recently searched for Objects Chatter
    8. 8. Mobile Navigation (aka Left Nav) Mobile Administration  Mobile Navigation
    9. 9. Page and Compact Layouts SObject  Page Layout SObject  Compact Layout
    10. 10. List Views Sobject Tab  New List View Tapping an object in the Left Nav displays your List Views and your Recent records Also shows any custom list views you created
    11. 11. Expanded Lookup Parent Sobject  Compact Layout Child SObject  Page Layout  Expanded Lookup Show additional info for Parent records
    12. 12. Built-in Map Integration for Accounts & Contacts Account  record  populate Billing Address or Shipping Address fields Map icon will automatically display at the top of the detail page.
    13. 13. Publisher Actions Global: Create  Global Actions Object Specific: SObject  Buttons, Links & Actions  New Action Page Layouts control which actions show in what order
    14. 14. Visualforce – Mobile Cards Mobile Cards - Visualforce Pages on Record Detail
    15. 15. Visualforce – Publisher Actions Visualforce Pages as Publisher Actions (VF page extends Standard Controller for Object Specific Publisher Actions) JavaScript Pub-Sub library available to interact with the publisher publisher.setValidForSubmit publisher.close
    16. 16. 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 TODO: URL for Salesforce Mobile Gallery / Mobile Packs
    17. 17. Visualforce – Left Nav Visualforce Pages in Left Nav JavaScript navigation library available etc.
    18. 18. Visualforce – Custom Publisher Action Visualforce Pages as Custom Publisher Actions Standard Controller JavaScript publisher library available Sfdc.canvas.publisher.publish etc
    19. 19. Visualforce – Formula Field Link Visualforce Pages as Formula Field Links
    20. 20. Salesforce 1 App Design Suggested approaches for configuring and customising apps for all devices
    21. 21. Book: Salesforce 1 Developer Guide -- search for “developer guide” Note: This book contains advice on the design of your Salesforce apps across all devices (web, tabliet, phone, etc)
    22. 22. Developer theatre, Library, Quick Starts, Mini Hacks, etc
    23. 23. Developer Library, Quick Starts, Mini Hacks, etc
    24. 24. Heroku1 Connect Connecting customer facing apps with your Salesforce Org
    25. 25. Building Customer Facing Apps on Salesforce1 This app runs on Heroku and select data is synchronized between the Heroku database and an associated Salesforce Org
    26. 26. Consumer Application with Heroku Connect Case CampaignProduct Contact Interactio n CampaignProduct Contact Interactio n Marketing Manager Customer Heroku Connect REST
    27. 27. Heroku Connect Object Mapping
    28. 28. Summary: Salesforce1 App and Platform  Fast non-programmatic mobile app development  Many hooks available to the developer to leverage  HTML5/JS/CSS supported Visualforce Development  HTTP standards based services integration  Great for internal employee facing apps
    29. 29. Resources Salesforce1 Platform Use Cases: Salesforce1 developer resources: Salesforce1 Mobile App Workshop:
    30. 30. Developer theatre, Library, Quick Starts, Mini Hacks, etc
    31. 31. Developer Library, Quick Starts, Mini Hacks, etc
    32. 32. Thank you John Stevenson @jr0cket