you can call the script include on your 2nd field as advanced reference qualifier. Reference Qualifiers - ServiceNow Wiki



sample code, please modify per your need.



var GetListValue = Class.create();


GetListValue.prototype = {


  initialize: function() {


  },



  getList : function()


  {


  var ids = [];


  var gr = new GlideRecord('Your table name');


  var sys_id = this.getParameter();


  gr.addQuery('<sys_id variable>', sys_id);


  gr.query();



  while(gr.next())


  {


  ids.push(gr.sys_id.toString());


  }


  return 'sys_idIN' + ids;


  },


  type: 'GetListValue'


};



also, i think you can create a datal ookup between between these two fields.