Get values from pxgrid in customization project

I am trying to get the values in the address column of my grid to plot point in google maps using the javascript api. I’ve seen other posts about using px_alls[“gridid”] to get the data but I can’t get it to read the items property when I do px_all[“grid”].rows.items even though there is a row with data in my grid. 

This is the code:

var map;
async function initMap() {
    const center = { lat: 32.86, lng: -80.02 };
    const { Map } = await google.maps.importLibrary("maps");
    const { AdvancedMarkerElement } = await google.maps.importLibrary("marker");
    const { Geocoder } = await google.maps.importLibrary("geocoding");

    /* the map */
    map = new Map(document.getElementById("map"), {
        zoom: 10,
        center: center,
        mapId: "DEMO_MAP_ID",

    /* get addresses from Acumatica field */
    var addresses = px_alls["grid"];

    /*var addressesToPlot = "Robisonia, PA; Mechanicsburg, PA; Philadelphia, PA";*/
    //var addresses = addressesToPlot.split(';');

    /* encode addresses as lat/lng */
        var rows= px_alls["grid"].rows;
        const geocoder = new Geocoder();
        for (var i=0; i<rows.length; i++)
            var currLine = (rows[i]);
            geocoder.geocode({ 'address': currLine.getCell(&quot;AddressLine1&quot;) }, (results, status) => {
                if (status == google.maps.GeocoderStatus.OK) {
                        const marker = new AdvancedMarkerElement({
                        map: map,
                        position: results[0].geometry.location,
                        title: currLine,



Any help on this would be appreciated!


Best answer by Cesar Betances 15 May 2024, 19:37

View original

2 replies

Badge +11

I believe you're looking at a question I originally posted. It's been a long time, but if I remember correctly, I was only using a single text field at this point with semicolon-separated values. This was a proof of concert project that never went any farther for me.

Userlevel 4
Badge +2

Hi @bguzman43,

It seems that the code snippet is making the iterations on px_alls[grid].rows but instead it should be on px_alls[grid].rows.items, you could see an example on this old post:


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved