I can't draw a simple polygon with leaflet in Dashlet SugarCRM

Hi people.

I'm trying integrate leaflet with SugarCRM in a Dashlet. Actually everything is ok with a simple map, and markers, but when I try to draw a simple polygon it doesn't work.

It's strange because I tested the same code in a simple html outside SugarCRM and it worked. Do you know if SugarCRM has any function block or is necesary any js configuration?

Here is the code, changeMarkerPosition function just draw or update the view map. And polygoning function take a simple array with coordenates point for draw the polygons.

function changeMarkerPosition(){

    var lat = $('#lat').val();
    var lng = $('#lng').val();
    if ( $('#argisFlag').val() === 'true' ) {
        map.panTo(new L.LatLng(lat, lng));
        marker = L.marker([lat, lng]).addTo(map);   
        polygoning();
    }else{
        map = L.map('map').
              setView([lat, lng], 18);  
        L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
                  attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
                  maxZoom: 15}).addTo(map);
    }
}

function polygoning() {
    let polygonArray = JSON.parse($("#groupPolyPoint").text());
    if (polygonArray[0].length > 0) {
        for (var i = polygonArray.length - 1; i >= 0; i--) {
            L.polygon(polygonArray[i], {color : 'red'}).addTo(map);;
        }
    }
}


Thanks for your help! (y)