Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

This package contains a Lightning component that gets a device's geolocation and returns it to a Salesforce flow.

License

Notifications You must be signed in to change notification settings

SFDC-Assets/Get-Geolocation

Creative Commons License In Development

GET GEOLOCATION

This package contains a Lightning component that gets a device's geolocation and returns it to a flow.

Summary

This Lightning Web Component is intended to be a (mostly) silent component that you can drag onto a flow screen and retrieve the device's current geolocation. The latitude, longitude, altitude, speed, and heading are returned in a set of variables that can be used by the flow.

Installation and Setup

Read the disclaimer below and click on the Install the Package link. This will install the component to your org.

Installation

If you are a Salesforce employee installing in an SDO, CDO, or IDO, you probably want to make sure that you select the button under the "Advanced" twisty to compile only the Apex in the package (although there is no Apex in the package).

The component is meant to be a minimalist mechanism for returning the device's location data to a Salesforce screen flow. To add the component to a flow, look for it in the Custom section of the Flow Builder. Simply drag it onto the screen and configure it.

Installation and Setup

There are three options you can configure for additional capability:

  • Show an error if no geolocation is available: Check this if you wish an error toast to appear if the device does not support geolocation. Note that you might have to approve geolocation for the device or the application to avoid errors.
  • Show a map with the geolocation: Check this if you want the component to display a Google map with the device's location.
  • Initial zoom level: Choose an initial zoom level for the map, if selected.

The component will return five variables: latitude, longitude, altitude, speed, and heading as output variables to the flow. You can use your own variables or use the defaults that are assigned by the flow. If you use your own, create them as follows:

Variables

There is an example flow called Example Flow for Get Geolocation LWC included in the package that you can use as a template. Make sure that you make a copy before you make changes to it as it will be overwritten the next time you upgrade the package.

How to Deploy This Package to Your Org

I am a pre-sales Solutions Engineer for Salesforce and I develop solutions for my customers to demonstrate the capabilities of the amazing Salesforce platform. This package represents functionality that I have used for demonstration purposes and the content herein is definitely not ready for actual production use; specifically, it has not been tested extensively nor has it been written with security and access controls in mind. By installing this package, you assume all risk for any consequences and agree not to hold me or my company liable. If you are OK with that ...

Install the Package

Maintainer

John Meyer / johnsfdemo

Current Version: 1.1.2