0

I wanted to create a function inside a different JS file called "MapMarkers.js", and then call that function to main JS file called "mapping.js". Importing the function to the main JS file seems like it working correctly. It's just seems like the "mapMarkers" property from the isn't reading the data?

If helpful here's the Map documentation:

https://developer.salesforce.com/docs/component-library/bundle/lightning-map/documentation

mapMarkers.js Code

export function MapMarkers(SearchCity, SearchState, SearchStreet){

    [
        {
            location: {

                City: SearchCity,
                Country: 'USA',
                State: SearchState,
                Street: SearchStreet,
                // PostalCode: ,
            },

            value: 'location001',
            title: 'Headquarters',
            description: 'Headquarters',
            // fillColor: '#CF3476',
            
        },

        {
            location: {

                City: 'Boston',
                Country: 'USA',
                State: 'MA',

            },

            value: 'MA_HQ',
            title: 'MA Headquarters',
            
        },

    ];

}

mapping.js Code

mapMarkers = MapMarkers(SearchCity, SearchState, SearchStreet);

1 Answer 1

0

Figured it out!

Needed to include:

const mapMarkers = [

&

return mapMarkers;


const mapMarkers = [
        {
            location: {

                City: SearchCity,
                Country: 'USA',
                State: SearchState,
                Street: SearchStreet,
                // PostalCode: ,
            },

            value: 'location001',
            title: 'Headquarters',
            description: 'Headquarters',
            
        },

        {
            location: {

                City: 'Milford',
                Country: 'USA',
                State: 'MA',
                // Street: '1224 abc St',

            },

            value: 'WES_MA_HQ',
            title: 'Headquarters',
            description: 'Headquarters',
            fillColor: '#CF3476',
            
        },

    ];

    return mapMarkers;

}

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.