<lightning-card  title={cardTitle}>
        <lightning-map map-markers={mapMarkers} > </lightning-map>


import { LightningElement, api, wire, track} from 'lwc';
import { getRecord, getFieldValue  } from 'lightning/uiRecordApi';
const NAME = 'Pokemon__c'
const LATITUDE = 'Pokemon__c.Geolocation__Latitude__s'
const LONGITUDE = 'Pokemon__c.Geolocation__Longitude__s'

const pokemonField = [NAME,LATITUDE, LONGITUDE];
export default class PokemonLocation extends LightningElement {

    @api recordId;
    @track mapMarkers =[]
    //Using wire method  to get record it
    @wire(getRecord,{recordId: '$recordId', fields:pokemonField })
    getPokemons({  data, error}){
            this.name = getFieldValue(data, NAME)
            this.cardTitle = this.name;
            const Latitude = getFieldValue(data, LATITUDE)
            const Longitude = getFieldValue(data, LONGITUDE)
            this.mapMarkers =[{
                location: {Latitude, Longitude},
                title: this.name,
                description: `Co-ords: ${Latitude} ${Longitude}`
        else if(error){
            console.log("THIS IS YOUR ERROR "+ error);
    console.log("Dance " +NAME);
    console.log("Data => " + JSON.stringify(this.mapMarkers));


ISSUE: The output is not showing the mapMarkers as it is somehow empty and I don't know why. Your help is appreciatd. Thanks

1 Answer 1


The NAME variable seems incomplete: it only has the name of your object, it's missing the field name. It should be Pokemon__c.Name or something similar. This is likely causing an issue with the @wire call to getRecord.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .