function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sumit dsumit d 

Aura component error

Hi All, 
          I have created a component in which I am getting this error:-This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read properties of undefined (reading 'config')] Failing descriptor: {force:record}

My component is given below:-

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="recordId" type="String" default="7012g00000ZoJ9aAAF"/>
    <aura:attribute name="record" type="Object"/>
    <aura:attribute name="simpleRecord" type="Object"/>
    <aura:attribute name="recordLoadError" type="String"/>
    <force:recordData aura:id="record"
    recordId="{!v.recordId}"
    fields="Name,Description,Street_Address__c,City__c,State__c,Country__c,Zip_Code__c"
    targetFields="{!v.simpleRecord}"
    targetError="{!v.recordLoadError}"
    />
     <!--aura:handler name="init" value="{!this}" action="{!c.doInit}"/-->
     
         
        <ltngMap:recordMap Name="{!v.simpleRecord.Name}"
                               Description="{!v.simpleRecord.Description}" 
                               Address="{!v.simpleRecord.Street_Address__c}" 
                               City="{!v.simpleRecord.City__c}"
                               State="{!v.simpleRecord.State__c}"
                               Country="{!v.simpleRecord.Country__c}"
                               ZipCode="{!v.simpleRecord.Zip_Code__c}"
                               />
    
</aura:component>

How to resolve this issue ?
Can anyone help me with this?
 
Sai PraveenSai Praveen (Salesforce Developers) 
hI Sumit,

Can you try what exactly you are trying to achieve with this component and can you share the controller and other logics related to it.

Thanks,
 
sumit dsumit d
Hi Sai,
           I was trying to create a map component that shows the Campaign address. for that, I have created LWC now. but the LWC is showing like the below Image
User-added image

My Component is given below:- 
<template>
    <template if:true={mapMarkers}>
        <lightning-map map-markers={mapMarkers}></lightning-map>
    </template>
</template>

Controller:- 

import { LightningElement, wire, api, track } from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import STREET_FIELD from '@salesforce/schema/Campaign.Street_Address__c';
import CITY_FIELD from '@salesforce/schema/Campaign.City__c';
import POSTCODE_FIELD from '@salesforce/schema/Campaign.State__c';
import NAME_FIELD from '@salesforce/schema/Campaign.Name';
import DESCRIPTION_FIELD from '@salesforce/schema/Campaign.Description';
import getCampaignsForMap from '@salesforce/apex/LightningMapsController.getCampaignsForMap';
export default class LightningMap extends LightningElement {
    @api recordId;
    @track mapMarkers;
 
    @wire(getRecord, {
        recordId: '$recordId',
        fields: [STREET_FIELD, CITY_FIELD, POSTCODE_FIELD, DESCRIPTION_FIELD, NAME_FIELD]
    })

    fetchCampaign({ data, error }) {
        console.log('recordId', this.recordId);
        console.log('hello');
        console.log('data', data);
        if (data) {
            this.mapMarkers = [
                {
                    location: {
                        Street: data.fields.Street_Address__c.value,
                        City: data.fields.City__c.value,
                        State: data.fields.State__c.value
                    },
                    title: data.fields.Name.value,
                    description: data.fields.Description.value
                }
            ];
            console.log('this.mapMarkers => ', JSON.stringify(this.mapMarkers));
        } else if (error) {
            console.error('ERROR => ', error);
        }
    }
}

Can you guide me on what I am missing here? Why Map is not showing properly?