Cannot read property 'gMarker' of undefined
Question

Hi I am using Google Maps Sample as a dependency on my app.

I am currently experiencing this error whenever I open a new window and then getting back on the Map Window:

TypeError: Cannot read property 'gMarker' of undefined
at https://grlg.outsystemscloud.com/banio/scripts/banio.MainFlow.Homepage.mvc.js?KGFZUy5xpLxcc5JF52cyBQ:1106:37
at Controller.e.safeExecuteJSNode (https://grlg.outsystemscloud.com/banio/scripts/OutSystems.js?e+GLPznkzYFAoVPAohcdhg:16:5651)
at Controller._marker_Unselect$Action (https://grlg.outsystemscloud.com/banio/scripts/banio.MainFlow.Homepage.mvc.js?KGFZUy5xpLxcc5JF52cyBQ:413:12)
at Controller._markerEvent_Click$Action (https://grlg.outsystemscloud.com/banio/scripts/banio.MainFlow.Homepage.mvc.js?KGFZUy5xpLxcc5JF52cyBQ:528:12)
at Controller._markerEvent$Action (https://grlg.outsystemscloud.com/banio/scripts/banio.MainFlow.Homepage.mvc.js?KGFZUy5xpLxcc5JF52cyBQ:952:12)
at https://grlg.outsystemscloud.com/banio/scripts/OutSystems.js?e+GLPznkzYFAoVPAohcdhg:16:17517
at d (https://grlg.outsystemscloud.com/banio/scripts/OutSystems.js?e+GLPznkzYFAoVPAohcdhg:2:15145)
at f (https://grlg.outsystemscloud.com/banio/scripts/OutSystems.js?e+GLPznkzYFAoVPAohcdhg:2:14891)
at Object.p [as tryCatchFinally] (https://grlg.outsystemscloud.com/banio/scripts/OutSystems.js?e+GLPznkzYFAoVPAohcdhg:2:15394)
at Controller.t.safeExecuteClientAction (https://grlg.outsystemscloud.com/banio/scripts/OutSystems.js?e+GLPznkzYFAoVPAohcdhg:16:17481)


Upon digging the cause is the JS on Marker_Unselect Action.


This is the code on the Javascript:


Anyone encountered this kind of error upon using the module?

mvp_badge
MVP
Solution

Hello Gab,

Did you try to copy how is implemented on sample pages of the module GoogleMapMobileSamples?

Please give a look below. Maybe this can help you:

Hi Luís,

I will try this code and will get back to you.

I think I haven't gotten on this one since I based the main map of my app on the functionality on Sample6 window of the module because it fit my requirement.

Thank you!

Thank you for the guidance Luís.

It fixed the error. Thanks!

mvp_badge
MVP

Hi,

gMarker is not a GoogleMap property or function, just remove from line 4 the text .gMarker

The marker is already selected by the Markers[...] part on code line 4.

Regards,

Daniel


Hi Daniël,

Thank you for your response.

Unfortunately, I already tried deleting gmarker on the JS but I encountered another error which is:

OSMap.markers[$parameters.MarkerId].setIcon is not a function

mvp_badge
MVP
Solution

Hello Gab,

Did you try to copy how is implemented on sample pages of the module GoogleMapMobileSamples?

Please give a look below. Maybe this can help you:

Hi Luís,

I will try this code and will get back to you.

I think I haven't gotten on this one since I based the main map of my app on the functionality on Sample6 window of the module because it fit my requirement.

Thank you!

Thank you for the guidance Luís.

It fixed the error. Thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.