meia_ahaesy
Mega Expert

You can loop through the records in u_pers_name and check to see if it contains the any of the names in sys_user via the indexOf method.



var gr = new GlideRecord('sys_user');


      gr.addQuery('first_name','Anna Marie');


      gr.query();


if(gr.next())


{


      var name = gr.first_name;


      var names = name.split(' '); // splitting this on a space.


      gs.print(names[0] +" and other split is " + names[1])//just checking the split



      var gl = new GlideRecord('u_validation');


                  gl.query();



        while(gl.next())


        {


                  if(names.indexOf(gl.u_pers_name) == -1)


                  { // the -1 indicates that the value passed in does not have a position within the array.


                            gs.print(names.toString());


                  }


        }


}



Slightly less efficient, but you'll probably get more accurate results, when the data is that variable.