Add new geopoint fails

Hello, when I add a new geopoint I get following error, but the point is created:

error - Cannot read property ‘objectId’ of undefined

Used source below:

var point = {
latitude : c[‘latitude’],
longitude : c[‘longitude’],
categories: [“Default”],
metadata: {“name”:c[‘metadata’][‘name’],“ort”:c[‘metadata’][‘ort’]}
};
Backendless.Geo.addPoint ( point )
.then( function( savedGeoPoint ) {
console.log( "geo point saved " + savedGeoPoint.geopoint.objectId );
})
.catch( function( error ) {
console.log( "error - " + error.message );
});

since I need to update a list in the then methode it is not that usefull.

Hi @Tom_Bock

I believe you the error comes from this line

console.log( "geo point saved " + savedGeoPoint.geopoint.objectId );

instead try this one

console.log( "geo point saved " + savedGeoPoint.objectId );

Regards, Vlad

1 Like

Thanks,
now it runs.