• Daniel Piserchia
  • NEWBIE
  • 5 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi all, I'm a little new to Salesforce and am hoping I can save myself a lot of stress by adapting some existing code.

https://trailhead.salesforce.com/content/learn/projects/develop-account-geolocation-app-with-aura-components

I've used this Trailhead to create the Account Locator in a Sandbox, and it works flawlessly. What I'm hoping to do is tweak everything to include leads on the map as well. I don't have any certs or prior experience with Salesforce, so I'm in a little over my head....but the Account Locator is already so close to what I need, so i'm hoping with some changes i can get a full fledged mapping feature going.
Thanks in advance for any assistance!
https://trailhead.salesforce.com/en/content/learn/projects/develop-account-geolocation-app-with-aura-components/develop-account-geo-app-create-account-map-component

I'm just working on this, and it all looks good until you start typing in the search box.

When delete the text to add next location
Code for AccountMapController.js
({
    onAccountsLoaded: function( component, event, helper ) {
        var mapMarkers = [];
        var accounts = event.getParam( 'accounts' );
        for ( var i = 0; i < accounts.length; i++ ) {
            var account = accounts[i];
            var marker = {
                'location': {
                    'Street': account.BillingStreet,
                    'City': account.BillingCity,
                    'PostalCode': account.BillingPostalCode
                },
                'title': account.Name,
                'description': (
                    'Phone: ' + account.Phone +
                    '<br/>' +
                    'Website: ' + account.Website
                ),
                'icon': 'standard:location'
            };
            mapMarkers.push( marker );
        }
        component.set( 'v.mapMarkers', mapMarkers );
    }
})
https://trailhead.salesforce.com/en/content/learn/projects/develop-account-geolocation-app-with-aura-components/develop-account-geo-app-create-account-map-component

I'm just working on this, and it all looks good until you start typing in the search box.

When delete the text to add next location
Code for AccountMapController.js
({
    onAccountsLoaded: function( component, event, helper ) {
        var mapMarkers = [];
        var accounts = event.getParam( 'accounts' );
        for ( var i = 0; i < accounts.length; i++ ) {
            var account = accounts[i];
            var marker = {
                'location': {
                    'Street': account.BillingStreet,
                    'City': account.BillingCity,
                    'PostalCode': account.BillingPostalCode
                },
                'title': account.Name,
                'description': (
                    'Phone: ' + account.Phone +
                    '<br/>' +
                    'Website: ' + account.Website
                ),
                'icon': 'standard:location'
            };
            mapMarkers.push( marker );
        }
        component.set( 'v.mapMarkers', mapMarkers );
    }
})