Weather Company Weather Recorder
Unmanaged Component Guide

This component allows you to see weather conditions associated with a case and save them for future use. For example, when a customer reports that their car was damaged by hail, the customer service representative can save a record of the current weather information and add it to the case. When the claims analyst reviews the case, they can see the weather information to verify that the damage could have been caused by hail.

The component adds the following weather data to case pages:

You can download the unmanaged component from GitHub. To set it up, add the API key from your paid data package subscription from The Weather Company and customize it per your needs. Alternatively, you can use the code as a sample to understand how the API works and then build your own standalone app.

Tip: The component is shipped with mock data so you can try it out before you obtain an API key.

Obtaining an API Key

By purchasing a data package and access key from The Weather Company, you can include any of the following data streams into the component:

To purchase a Weather Company data package, Weather Company Data for Salesforce.

Installing and Configuring the Component

System Requirements

The component is supported for Salesforce editions that include case management. Lightning Experience must be enabled. The component is not supported in Salesforce Classic. The component is supported on all browsers that are supported for Lightning Experience (see Supported Browsers for Lightning Experience in the Salesforce documentation).

Setting Up the Component

Prerequisite: Prior to installation, ensure Lightning Experience is enabled (see Enable Lightning Experience).

To set up the component:

  1. Get the component from GitHub and deploy it to Salesforce.
  2. Add the Weather Location field and Weather Records related list to the case page. The component displays the weather for the location specified in the Weather Location custom field. The Weather Records related list displays all the records that are associated with the case.
    1. In Setup > Object Manager, edit the page layout for the case object.
    2. Add the Weather Location field to the case detail section.
    3. Add the Weather Records related list to the related lists section.
  3. Grant users the required permissions for the component. In Setup > Permission Sets, assign users the Weather Recorder permission set (see Assign a Permission Set to Multiple Users).
  4. Add the component to the case page by editing the page in the Lightning App Builder (see Configure Lightning Experience Record Pages).
    1. In the Lightning Components list, scroll down to the Custom section.
    2. Click Weather Company Weather Recorder and drag the component to any place on the page.
    3. In the properties pane, select the default type of units to display.
    4. Save and activate the updated page.

The component is now running with mock data.

Enabling the component to display real data

After you obtain an API key (see Weather Company Data for Salesforce), enable the component to display real weather data.

To enable the component to display real data:

  1. In Salesforce, create a CSP Trusted Site for https://api.weather.com to access the Weather Company APIs (see Create CSP Trusted Sites to Access Third-Party APIs).
  2. Enter the API key. In Custom Metadata Types, edit the SUN_Weather API record (see Add or Edit Custom Metadata Records Declaratively). For the API Key field, specify the API key you received when you purchased the data package. For the API User field, don’t specify a value. Tip: If the API Key field is not displayed for the API record, edit its page layout.
  3. Disable the sample data response and activate the API calls to Weather.com. In the src/aura/weatherrecord/weatherrecord.cmp file, change the useMockup attribute to false. Tip: To improve performance, configure Salesforce to automatically add geocodes to all Account, Contact, and Lead records (see Set Up Geocode Data Integration Rules). The component then uses the geocode values instead of making API calls to determine the latitude and longitude for each address.

Extending the Component

You can extend the component by purchasing a data subscription and customizing the code to add more historical information to the weather records, such as:

For more details about how to extend the component, see the comments in the code.

Restrictions

The component shows data for locations in the U.S. and Canada only. The user interface is available in English only.