Newer Version Available

This content describes an older version of this product. View Latest

Fire the Events

Fire the events in your client-side controller or helper functions. The force events are handled by Salesforce1.
This demo builds on the contacts component you created in Load the Contacts.
  1. In the contactList sidebar, click CONTROLLER to create a new resource named contactListController.js. Replace the placeholder code with the following code and then save.
  2. Refresh the Salesforce1 mobile browser app, and click these elements to test the events.
    • Contact: force:navigateToSObject is fired, which updates the view with the contact record page. The contact name corresponds to the following component.
    • Edit Contact button: force:editRecord is fired, which opens the edit record page. The Edit Contact icon corresponds to the following component.
  3. Open contactsController.js. After the doInit controller, enter this code and then save.
Notice that if you pull down the page and release it, the page refreshes all data in the view. Now you can test your components by clicking on the areas highlighted in Create a Component for Salesforce1 and Lightning Experience.

For an example on creating a standalone app that can be used independent of Salesforce1, see Create a Standalone Lightning App.