Hi.Community...how to get table name dynamically?

Nana5
Mega Guru

Hi

I have a field called 'equipment' and its referring to 'cmdb_model_category' table. based on model category selection i need to get the table of that category.

below the model category, i have selected computer so i need the table name of computer dynamically. How i can achieve that please help me out.

currently m only getting the sys_id of computer but i need the table name too.

function ShowClient(){

  var equipment_val = gel('equipment').value;

;

  if(equipment_val==''){

  alert("Please Select Equipment");

  return false;

  }else{

  //var url = ""need to get table name dynamically".do?sys_id=" + equipment_val;

   

  window.open(url,"width=50, height=50");

  }

}

find_real_file.png

Thanks

Prakash Ranjan

11 REPLIES 11

sumeet_n
Kilo Guru

Hi Prakash,



Is this what you are looking for?



GlideElement - ServiceNow Wiki


Mohamed Faizel
Giga Expert

Hi,



Try the below lines,



var table = g_form.getTableName();


var url = table + ".do?sys_id=" + equipment_val";


window.open(url,"width=50, height=50");



Thanks,


Mohamed