Update Performance Analytics scripts
Platform Analytics Solutions include Performance Analytics scripts to perform calculations on records. These scripts use the time stamp fields from the indicator sources. If you change the time field stamps in an indicator source, also modify the related scripts.
Before you begin
Important: If you did not update any indicator sources in your Platform Analytics Solutions, skip this task.
Role required: pa_admin, admin
Procedure
-
Navigate to All > Performance Analytics > Automation > Scripts.
-
Click a script to open its details.
For example, the Change.CloseTime.Hours script record contains the following script:
JavaScriptvar diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};var hours=function(x,y){return diff(x,y)/(60*60*1000);};hours(current.opened_at, current.closed_at); -
In the Source section, click the lock icon next to the list of Fields.
[Omitted image "update-scripts-fields-lock.png"] Alt text: The Fields list in a script record, showing the lock icon
The Fields selector opens.
-
Move the desired fields into the fields that are Selected for the script, and remove fields that are not appropriate.
For example, if your organization uses the Created time stamp field to define a new change, replace Opened with Created.
[Omitted image "update-scripts-select-fields.png"] Alt text: Fields selector after Opened has been removed and Created has been added
-
In the Script field, replace the references to disused fields with references to the fields you just selected.
In this example, references to the Opened field are replaced by references to Created.
JavaScriptvar diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};var hours=function(x,y){return diff(x,y)/(60*60*1000);};hours(current.opened\_atcurrent.sys_created_on, current.closed_at); -
Click Update to save your changes.
Parent Topic:Configure Platform Analytics Solutions
Previous topic:Review the indicator sources
Next topic:Review the breakdown sources
---
title: Update Performance Analytics scripts
description: Platform Analytics Solutions include Performance Analytics scripts to perform calculations on records. These scripts use the time stamp fields from the indicator sources. If you change the time field stamps in an indicator source, also modify the related scripts.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/australia/now-intelligence/performance-analytics/update-pa-scripts.html
release: australia
product: Performance Analytics
classification: performance-analytics
topic_type: task
last_updated: "2026-09-10"
reading_time_minutes: 1
breadcrumb: [Configure Platform Analytics Solutions, Platform Analytics solutions, Reporting, dashboards, and Performance Analytics in the Core UI, Platform Analytics]
---
# Update Performance Analytics scripts
Platform Analytics Solutions include Performance Analytics scripts to perform calculations on records. These scripts use the time stamp fields from the indicator sources. If you change the time field stamps in an indicator source, also modify the related scripts.
## Before you begin
**Important:** If you did not update any indicator sources in your Platform Analytics Solutions, skip this task.
Role required: pa\_admin, admin
## Procedure
1. Navigate to **All** > **Performance Analytics** > **Automation** > **Scripts**.
2. Click a script to open its details.
For example, the Change.CloseTime.Hours script record contains the following script:
```
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.opened_at, current.closed_at);
```
3. In the Source section, click the lock icon next to the list of Fields.
\[Omitted image "update-scripts-fields-lock.png"\] Alt text: The Fields list in a script record, showing the lock icon
The Fields selector opens.
4. Move the desired fields into the fields that are **Selected** for the script, and remove fields that are not appropriate.
For example, if your organization uses the **Created** time stamp field to define a new change, replace **Opened** with **Created**.
\[Omitted image "update-scripts-select-fields.png"\] Alt text: Fields selector after Opened has been removed and Created has been added
5. In the **Script** field, replace the references to disused fields with references to the fields you just selected.
In this example, references to the **Opened** field are replaced by references to **Created**.
```
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var hours=function(x,y){return diff(x,y)/(60*60*1000);};
hours(current.opened\_atcurrent.sys_created_on, current.closed_at);
```
6. Click **Update** to save your changes.
**Parent Topic:**[Configure Platform Analytics Solutions](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/configure-nowintel-solutions.md)
**Previous topic:**[Review the indicator sources](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/review-indicator-sources.md)
**Next topic:**[Review the breakdown sources](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/review-breakdown-sources.md)
| title | Update Performance Analytics scripts |
| description | Platform Analytics Solutions include Performance Analytics scripts to perform calculations on records. These scripts use the time stamp fields from the indicator sources. If you change the time field stamps in an indicator source, also modify the related scripts. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/australia/now-intelligence/performance-analytics/update-pa-scripts.html |
| release | australia |
| product | Performance Analytics |
| classification | performance-analytics |
| topic_type | task |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | Configure Platform Analytics SolutionsPlatform Analytics solutionsReportingdashboardsand Performance Analytics in the Core UIPlatform Analytics |