PADomainUtils - Global

The PADomainUtils API allows you to copy Performance Analytics configurations between different domains.

Use this API in server scripts to copy Performance Analytics configuration records, such as indicators, breakdowns, and dashboards, to different domains. This API enables you to create a Performance Analytics configuration in one domain and copy that configuration to any number of additional domains.
Note: This API cannot copy records into the Global domain.
To use PADomainUtils, you must satisfy these requirements:
  • Performance Analytics Premium must be enabled
  • The user running the script must have the admin role
  • The instance must use domain separation
  • The script must be run from the global domain
  • When moving or copying records, the source and target domains must be different

PADomainUtils - copy(String runAs)

Copy Performance Analytics configuration records to a different domain.

Table 1. Parameters
Name Type Description
runAs String The user whose domain you want to copy records to.
Table 2. Returns
Type Description
void

// copy all the Performance Analytics records from global to user's domain
var pa = new SNC.PADomainUtils();
pa.copy('09ff3d105f231000b12e3572f2b4775d');

PADomainUtils - copyJob(String paJob, String runAs)

Copy a Performance Analytics scheduled data collection job record to another domain.

Table 3. Parameters
Name Type Description
paJob String The sys_id of a Performance Analytics scheduled data collection job [sysauto_pa] record.
runAs String The user whose domain you want to copy the record to.
Table 4. Returns
Type Description
String An error message if an error occurs, or an empty string if there is no error.

// No source domain needs to be set
var pa = new SNC.PADomainUtils();
// copy the OOTB '[PA Incident] Daily Data Collection job'
// set the 'run as' of the new record to be the 'acme.itil' user
// first argument is the sys_id of the sysauto_pa record
// the second is the sys_id of the acme.itil user record
pa.copyJob('82ba2023d7101100b96d45a3ce6103cd','797d14341f1310005a3637b8ec8b7010');

PADomainUtils - isWriteable(String table, String id)

Evaluate if you can write to a specific record identified by table and sys_id.

Table 5. Parameters
Name Type Description
table String The name of the table containing the record to query, such as pa_indicators.
id String The sys_id of the record to query.
Table 6. Returns
Type Description
Boolean Indicates that you can write to the specified record. Returns true if the record exists within the domain of the current user. Returns false if the record does not exist, or is in a different domain.
var pa = new SNC.PADomainUtils();
pa.isWriteable('pa_incidents','cd8125b5140012007665a83e633b028d');

PADomainUtils - move(String runAs)

Move Performance Analytics configuration records to a different domain.

Table 7. Parameters
Name Type Description
runAs String The user whose domain you want to copy records to.
Table 8. Returns
Type Description
void

// move all the Performance Analytics records from the global to the customers domain
var pa = new SNC.PADomainUtils();
pa.move('774190f01f1310005a3637b8ec8b70ef')

PADomainUtils - PADomainUtils()

Instantiate a new PADomainUtils object to move or copy Performance Analytics configuration records from the global domain.

Use the PADomainUtils(String domainFrom) constructor instead when moving or copying records from a domain other than the global domain.

Table 9. Parameters
Name Type Description
None

// PADomainUtils initialized with the global domain
var globalUtils = new SNC.PADomainUtils();

PADomainUtils - PADomainUtils(String domainFrom)

Instantiate a new PADomainUtils object to move or copy Performance Analytics configuration records from the specified domain.

Use the PADomainUtils() constructor instead when moving or copying from the global domain.

Table 10. Parameters
Name Type Description
domainFrom String The domain to copy records from.

// c90d4b084a362312013398f051272c0d is the sys id of the ACME domain
var acmeUtils = new SNC.PADomainUtils('c90d4b084a362312013398f051272c0d');

PADomainUtils - setFoundation(Boolean foundation)

Use this method to move or copy only foundation records in a hybrid domain configuration.

You can implement a hybrid configuration by maintaining some types of record in a parent domain and some types in child domains. Records maintained in the parent domain are known as foundation records. The following types of record are considered foundation records.
  • Bucket groups
  • Buckets
  • Scripts
  • Breakdown sources
  • Indicator sources
  • Filters
  • Breakdowns
  • Managed sources
  • Manual breakdowns
  • Breakdown mappings
  • Breakdown relations
Other Performance Analytics configuration records such as widgets and indicators are not foundation records. Set this method to false to move or copy these additional records as well.
Table 11. Parameters
Name Type Description
foundation Boolean Indicates if only foundation records should be copied or moved by this PADomainUtils object.
Table 12. Returns
Type Description
PADomainUtils The object calling this function.

var pa = new SNC.PADomainUtils().setFoundation(true);
pa.copy('bb6b58b01f1310005a3637b8ec8b70dd');

PADomainUtils - setOverrides(Boolean overrides)

Use this method before copying records to set the sys_override value of the new record to the original parent record.

Using this method allows you to automatically override records in a parent domain. By overriding the parent records, the parent records do not impact the child domain. If the source domain is not the parent of the target domain when copying records, setting the sys_override value will not have any impact on behavior. You can specify an override only when copying records, not when moving records.

Table 13. Parameters
Name Type Description
overrides Boolean Indicates that copied records in a child domain should override the source record in the parent domain. This value is true by default.
Table 14. Returns
Type Description
PADomainUtils The object calling this function.

var pa = new SNC.PADomainUtils('c90d4b084a362312013398f051272c0d');
pa.setOverrides(false);
pa.copy('bb6b58b01f1310005a3637b8ec8b70dd');