Name

global.getAvailableAttributes

Description

Returns an encoded query used by the reference qualifier on sys_schema_attribute_m2m.attribute. This is used to enforce that table attributes can only be applied to tables, and column attributes can only be applied to columns.

Script

function getAvailableAttributes() {
  var query = '';
  
  if (current.schema.internal_type == 'collection')
  	query += 'applies_to!=COLUMN'; //Can be either TABLE or BOTH
  else {
  	query += 'applies_to!=TABLE';  //Can be either COLUMN or BOTH
  	query += '^column_typeISEMPTY^ORcolumn_type=' + getFieldClassRecord(current.schema.internal_type);
  	query += '^on_tableISEMPTY^ORon_table=' + getTableRecord(current.schema.name);
  	query += '^column_on_tableISEMPTY^ORcolumn_on_table=' + current.schema.sys_id;
  }
  
  return query;
}

function getFieldClassRecord(name) {
  var gr = new GlideRecord('sys_glide_object');
  gr.get('name', name);
  return gr.sys_id.toString();
}

function getTableRecord(name) {
  var gr = new GlideRecord('sys_db_object');
  gr.get('name', name);
  return gr.sys_id.toString();
}

Sys ID

fca82e22eb321100d4360c505206fe47

Offical Documentation

Official Docs: