Create a script in Performance Analytics

To create a script, first select the facts table to which the script applies and explicitly select any fields.

Before you begin

Role required: admin, pa_admin


  1. Navigate to Performance Analytics > Scripts and click New.
  2. Give the script a descriptive Name.
  3. Select the Facts table that the script applies to.
    Only indicators that use the same facts table can use this script.
  4. Select the fact table Fields, if any, that will be used in the script.
    You select fields by their labels.
  5. Write the script.
    The script must conform to the following relationships and restrictions:
    • You can include only the fields that are selected in this form and the universal script variables .
    • When you use a field in the script, you use the column name. If necessary, look up the column name in the facts table.
    • When you use a field from a database view, you must include the prefix. For example, the incident_sla database view includes the task_sla table, with the prefix taskslatable. Task_sla includes the business_duration column. To use the business_duration field from the incident_sla database view, write it as taskslatable_business_duration. If you do not have access to the database view, ask your system administrator to find the prefix for you.

Performance Analytics script variables

Several variables are available for use in Performance Analytics scripts and formula scripts.

You can use the following variables in Performance Analytics scripts and formula indicator scripts. You can obtain a GlideDateTime object from these variables by calling getGlideObject(), such as in this example: gs.log("Score main = " + score_end.getGlideObject().getDayOfWeek());

  • score_start: start of the data collection period
  • score_end: end of the data collection period

The values of these variables are bound to the data collection period. For example, if a monthly indicator is being collected, the score_end is the end of the month.