Skip to content

GraphQL Map View

Configurable map component for displaying locations via Google Maps API using LWC GraphQL Wire Adapter.

Available in: Record Page

graphql-map-view

Read on Medium

Replace Apex with GraphQL in Your Salesforce UI Architecture

Replace Apex with GraphQL in Your Salesforce UI Architecture

Attributes

NameTypeDefaultDescription
record-idstringIf the component is used on a lightning record page, the page sets the property to the id of the current record.
object-api-namestringIf the component is used on a lightning record page, the page sets the property to the API name of the current object.
heightstring'400px'Height of the map component in percent or pixels. The default is 400px.
widthstring'100%'Width of the map component in percent or pixels. The default is 100%.
list-viewstring'auto'Displays or hides the list of locations. Valid values are visible, hidden, or auto.
zoom-levelstringSupports zoom levels from 1 to 20. If not specified, the component calculates a zoom level to accommodate the markers in the map.
title-fieldstring'Name'API name of the field that contains the location title. The default is the Name field.
city-fieldstringAPI name of the field that contains the city.
country-fieldstringAPI name of the field that contains the country.
postal-code-fieldstringAPI name of the field that contains the postal code.
state-fieldstringAPI name of the field that contains the state.
street-fieldstringAPI name of the field that contains the street.

Usage

html
<c-graphql-map-view
  record-id={recordId}
  object-api-name="Account"
  title-field="Name"
  street-field="BillingStreet"
  city-field="BillingCity"
  postal-code-field="BillingPostalCode"
  country-field="BillingCountry"
></c-graphql-map-view>

The component is designed for Lightning record pages: drop it onto the page in the Lightning App Builder and map the address fields of the current object. The record-id and object-api-name attributes are set automatically by the record page.

Released under the MIT License.