The code
GlideTableDescriptor.get(data.table).getED().hasAttribute("glide.security.ui.filter")
tests whether the table data.table has attribute with the name glide.security.ui.filter. No standart tables has the attribute. So you can just remove the part of code. If you do want to use the code, that you have to rewrite the fragment to get the same information about attributes of the table in alternative way.
I posted in my answer on the question the code of small function isTableAttributeEqualValue. The code shows how one can get attributes of table. You need just modify the last line of the code to use only return gr.next(). The resulting function will looks as following
function isTableHasAttribute (tableName, attributeName) {
var gr = new GlideRecord("sys_schema_attribute_m2m");
gr.addQuery("schema.name", tableName); // "Dictionary Entry"."Table"
gr.addQuery("attribute.name", attributeName); // "Attribute"."Name"
gr.query();
return gr.next();
}
Then you can use isTableHasAttribute(data.table, “glide.security.ui.filter”) instead of GlideTableDescriptor.get(data.table).getED().hasAttribute(“glide.security.ui.filter”).


I want to delete the column「shin_ryokin_4」in my table[「x_msbl_jinji_kyuyo_tb_tsukinteate」,and this is my script in Servicenow Script-Backgroud:
var tableName = ‘x_msbl_jinji_kyuyo_tb_tsukinteate’;
var columnName = ‘shin_ryokin_4’;
var tableDescriptor = new GlideTableDescriptor(tableName);
tableDescriptor.removeColumn(columnName);
gs.print(‘Column ‘ + columnName + ‘ in table ‘ + tableName + ‘ removed.’);
I was already run this script,but not success.
here is the error:
Background message, type:error, message: GlideTableDescriptor is not allowed in scoped applications.
How should I change my code to successfully delete the column 「shin_ryokin_4」.
Looking forward to your reply.
Install xplore and execute the code in Global scope