14 Replies · Latest reply on May 19, 2017 12:50 PM by Toby Logan

    I am new to this but have some background.  I can figure out how to query the zip code from my lat long database and then pull the user record up and transfer the lat long.  Here is my code.

      var results = [];

      var gr = new GlideRecord('sys_user');

      var zp = new GlideRecord('u_zip_to_lat_long')

      gr.addQuery('u_adjuster', 1);

      gr.setLimit('5');

      gr.query();

      results.push('\r\r');

      while(gr.next()) {

        if (gr.u_adjuster) {

          gr.setLimit('1');

          zp.query('u_zip', gr.zip);  \\Problem is here

          zp.next();

          results.push('Zip Record: ' + zp.u_zip + ', Adjuster= ' + gr.name + ', ' + gr.zip + '\r');

          gr.city = zp.u_city;

          gr.state = zp.u_state;

          gr.latitude = zp.u_lat;

          gr.longitude = zp.u_long;

          results.push('Updated: ' + gr.name + ', Adjuster= ' + gr.u_adjuster +'\r');

      //   gr.update();  

        }

      }

      gs.info(results.join(''));