Name

global.getAvailableUIPolicyViews

Description

Returns an array of Sys IDs that indicate which UI Views a UI Policy should have access to. This is used in a Dynamic Filter Option for the sys_ui_policy.view dynamic reference qualifier.

Script

// policyTableName is the name of the table the UI Policy
// applies to
function getAvailableUIPolicyViews(policyTableName) {
  var views = {};
  ['sys_ui_form', 'sys_ui_section'].forEach(function(tableName) {
  	var ga = new GlideAggregate(tableName);
  	ga.addQuery('view', '!=', 'Default view');
  	ga.addQuery('name', policyTableName);
  	ga.addAggregate('COUNT');
  	ga.groupBy('view');
  	ga.query();
  	while (ga.next())
  		views[ga.getValue('view')] = 1;
  });
  return Object.keys(views);
}

Sys ID

27af3d41eb230100d4360c505206feaa

Offical Documentation

Official Docs: