I have a custom field with Fieldname map of type Geolocation as shown in the image attached.
Here is the custom script:
onload(frm) {
//Reference for project map
var projectmap = frm.doc.map;
//Multi-dimension array to store project coordinates
var projectlatlngs = [];
//Loop through Project's land coordinates and draw a plot of it
$.each(frm.doc.land_coordinates, function(land_project_coordinates_index, land_project_coordinates){
projectlatlngs.push([land_project_coordinates.longitude, land_project_coordinates.latitude]);
})
var projectpolyline = L.polyline(projectlatlngs, {color: 'indigo', opacity: 1, weight: 1, fill: 1, fillOpacity: 0.2, fillColor: 'indigo'}).addTo(map);
map.fitBounds(projectpolyline.getBounds());
}
});```
And I get the following error:
Uncaught (in promise) ReferenceError: ***map is not defined***
at onload (eval at setup (script_manager.js:160), <anonymous>:12:150)
at a (script_manager.js:90)
at script_manager.js:108
