You need to sign in to do that
Don't have an account?

Lightning component framework specialist superbadge step 10 : Issue in passing geolocation as an event parameters
Hi,
I am having issue in passing latitude and longitude as an event parameters. Below is my onBoatClick controller.
console.log display label and boat Id. However values for lat and lon is undefined. Not sure, what I am missing here.
Any help is appreciated.
Thanks much.
I am having issue in passing latitude and longitude as an event parameters. Below is my onBoatClick controller.
({ onBoatClick : function(component, event, helper) { var BoatSelectEvent = component.getEvent("BoatSelect"); var boatSelected = component.get("v.boat"); BoatSelectEvent.setParam( "boatId",boatSelected.Id); BoatSelectEvent.fire(); var BoatSelectedEvt = $A.get("e.c:BoatSelected"); var Boat = component.get("v.boat"); BoatSelectedEvt.setParams({ "boat" : Boat }) ; console.log('Firing event' +Boat); BoatSelectedEvt.fire(); var boat=component.get('v.boat'); console.log('Boat Selected Id in boattile' + boat.Id); var lat = boat.Geolocation_Latitude__s; var long = boat.Geolocation_Longitude__s; var label = boat.Name; console.log('boat name in BoatTile'+ label); console.log('Latitude in BoatTile' + lat); console.log('Longitude in BoatTile' + long); var PlotMapMarkerEvent = $A.get("e.c:PlotMapMarker"); PlotMapMarkerEvent.setParams({ "lat" : lat, "long" : long, "label" : label, "SObjectId" : boat.Id }); PlotMapMarkerEvent.fire(); } ,
console.log display label and boat Id. However values for lat and lon is undefined. Not sure, what I am missing here.
Any help is appreciated.
Thanks much.
https://raw.githubusercontent.com/donaldrivard/Lightning_Component_Framework_Specialist/384cc06741a010adc88c6abedebe559df5436e89/deploy/aura/BoatTile/BoatTileController.js
I had a similar issue with the geolocation returning 'undefined'.
Like siripurapu said make sure you query for those fields. Also the OP missed the double underscore betweem 'Geolocation' and 'latitude' and 'longitude' so that would be a problem for them.
What really got me is according to salsforce documentation 'Geolocation__latitude__c' is correct and it is queried as such with no problem... BUT the returned values in the js controller of 'latitude' and 'longitude' are CAPITALIZED... and since js is case sensitive you have to reference them as such 'Geolocation__Latitude__c', etc...
Hope I save someone some time. Cheers!
This should solve mostly.