I'm trying to write a Screen Flow component that gets the users current location from the device/browser and displays it on a map so they can confirm the location. I can capture the geolocation, and the map renders, but no marker is placed. Below are the Component and controller details


<aura:component implements="lightning:availableForFlowScreens" access="global" >   
    <aura:attribute name="latitude" type="Decimal" access="global"/>    
    <aura:attribute name="longitude" type="Decimal" access="global"/>
    <aura:attribute name="mapMarkersData" type="Object" />
    <aura:attribute name="showFooter" type="Boolean" default="true" />
    <aura:attribute name="zoomLevel" type="Integer" default="16" />
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:card iconName="standard:address" title="Location Details">
        <lightning:formattedLocation latitude="{!v.latitude}" longitude="{!v.longitude}" />
        <aura:if isTrue="{! v.latitude > 0 }"> 
                       mapMarkers="{! v.mapMarkersData}"
                       zoomLevel="{! v.zoomLevel}"
                       showFooter="{! v.showFooter}" listView="hidden" />



    init : function(component, event, helper) {
            function success(position){                
                var CurrLat = position.coords.latitude;
                component.set("v.latitude", CurrLat);
                var CurrLong = position.coords.longitude;
                component.set("v.longitude", CurrLong);
                console.log("CurrentLocation: " + CurrLat + "," + CurrLong);
            component.set("v.mapMarkersData", [
                location: {
                    Latitude: "v.latitude",
                    Longitude: "v.longitude"
        } else {
            error('Location unavilable, check device settings');

Any help greatly appreciated from a novice coder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.