Name

sn_lookup_verify.LAVRelationshipFilter

Description

No description available

Script

var LAVRelationshipFilter = Class.create();
LAVRelationshipFilter.prototype = {
  initialize: function() {
  },
  
  process: function(table, containingTable, dependentValue){
  	var result = [];
  	if(!table || !containingTable || !dependentValue)
  		return result;
  	if(table == dependentValue)
  		result.push("sys_id");
  	else {
  		var ancestors = new GlideTableHierarchy(table).getTables();
  		ancestors = ancestors.toString();
  		ancestors = ancestors.replace("[", "");
  		ancestors = ancestors.replace("]", "");
  		ancestors = ancestors.replace(" ", "");
  		var gr = new GlideRecord("sys_dictionary");
  		gr.addQuery("name","IN", ancestors);
  		gr.addQuery("internal_type","reference");
  		gr.addQuery("reference",dependentValue);
  		gr.query();
  		while(gr.next())
  			result.push(""+gr.element);
  	}
  	return result;
  },

  type: 'LAVRelationshipFilter'
};

Sys ID

82497348b314230001f34d43c6a8dc02

Offical Documentation

Official Docs: