Check if a column exists on a table in a server script


var grDict=new GlideRecord('sys_dictionary');
grDict.addQuery('name', 'cmdb_ci_computer');
grDict.addQuery('element','cd_rom');
grDict.query();
gs.print(grDict.getRowCount());//--column exists, output is 1



var grDict=new GlideRecord('sys_dictionary');
grDict.addQuery('name', 'cmdb_ci_computer');
grDict.addQuery('element','cd_romZ');
grDict.query();
gs.print(grDict.getRowCount());//--column does not exist, output is 0

Comments

Popular posts from this blog

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy

GlideRecord setValue