---
schema_version: "1"
id: f9903f6e3ae1ab3d705521c3fa2023636a4e33b1708088acd4f915fdac627114
title: Fire the Events
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/events/events-one-demo-fire.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/events-one-demo-fire.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: dc4a5e2740b2c6dc9bc42baf5144e93888fcb2703fc1b94e28b3d3c7fd2483df
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Fire the Events

Fire the events in your client-side controller or helper functions. The `force` events are handled by Lightning Experience and the Salesforce mobile app, but let’s view and test the components in Lightning Experience to simplify things.

This demo builds on the contacts component you created in [Load the Contacts](https://developer.salesforce.com/docs/platform/aura-platform/guide/events-one-demo-load.md).

1.  In the **contacts** sidebar, click **CONTROLLER** to create a resource named `contactsController.js`. Replace the placeholder code with the following code and then save.

    <!-- otherprops: set_clipboard -->

    ```javascript
    ({
      goToRecord: function (component, event, helper) {
        // Fire the event to navigate to the contact record
        var sObjectEvent = $A.get("e.force:navigateToSObject");
        sObjectEvent.setParams({
          recordId: component.get("v.contact.Id"),
        });
        sObjectEvent.fire();
      },
    });
    ```

    The `onclick` event handler in the following button component triggers the `goToRecord` client-side controller when the button is clicked.

    ```nolang
    <lightning:button name="details" label="Details" onclick="{!c.goToRecord}" />
    ```

    You set the parameters to pass into the events using the `event.setParams()` syntax. In this case, you’re passing in the Id of the contact record to navigate to. There are other events besides `force:navigateToSObject` that simplify navigation within Lightning Experience and the Salesforce app. For more information, see [Events Handled in the Salesforce Mobile App and Lightning Experience](https://developer.salesforce.com/docs/platform/aura-platform/guide/events-one.md).

2.  To test the event, refresh your custom tab in Lightning Experience, and click the **Details** button.

    The `force:navigateToSObject` is fired, which updates the view to display the contact record page.

We stepped through creating a component that loads contact data using a combination of client-side controllers and Apex controller methods to create a custom UI with your Salesforce data. The possibilities of what you can do with Aura components are endless. While we showed you how to surface a component via a tab in Lightning Experience and the Salesforce app, you can take this tutorial further by surfacing the component on record pages via the Lightning App Builder and even Experience Builder. To explore the possibilities, blaze the trail with the resources available at [Trailhead: Explore Lightning Aura Components Resources](https://developer.salesforce.com/docs/platform/aura-platform/qs-aotp/qs-aotp-app.md).
