{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":35923,"path":"now-intelligence/performance-analytics/update-pa-scripts.md","title":"Update Performance Analytics scripts","bundle":null,"doc_type":null,"release":"australia","body":"\n# Update Performance Analytics scripts\n\nPlatform 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.\n\n## Before you begin\n\n**Important:** If you did not update any indicator sources in your Platform Analytics Solutions, skip this task.\n\nRole required: pa\\_admin, admin\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Performance Analytics** &gt; **Automation** &gt; **Scripts**.\n\n2.  Click a script to open its details.\n\n    For example, the Change.CloseTime.Hours script record contains the following script:\n\n    ```\n    var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};\n    var hours=function(x,y){return diff(x,y)/(60*60*1000);};\n    hours(current.opened_at, current.closed_at);\n    ```\n\n3.  In the Source section, click the lock icon next to the list of Fields.\n\n    \\[Omitted image \"update-scripts-fields-lock.png\"\\] Alt text: The Fields list in a script record, showing the lock icon\n\n    The Fields selector opens.\n\n4.  Move the desired fields into the fields that are **Selected** for the script, and remove fields that are not appropriate.\n\n    For example, if your organization uses the **Created** time stamp field to define a new change, replace **Opened** with **Created**.\n\n    \\[Omitted image \"update-scripts-select-fields.png\"\\] Alt text: Fields selector after Opened has been removed and Created has been added\n\n5.  In the **Script** field, replace the references to disused fields with references to the fields you just selected.\n\n    In this example, references to the **Opened** field are replaced by references to **Created**.\n\n    ```\n    var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};\n    var hours=function(x,y){return diff(x,y)/(60*60*1000);};\n    hours(current.opened\\_atcurrent.sys_created_on, current.closed_at);\n    ```\n\n6.  Click **Update** to save your changes.\n\n\n**Parent Topic:**[Configure Platform Analytics Solutions](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/configure-nowintel-solutions.md)\n\n**Previous topic:**[Review the indicator sources](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/review-indicator-sources.md)\n\n**Next topic:**[Review the breakdown sources](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/review-breakdown-sources.md)\n\n"}}