Use script includes with Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2023 01:30 PM
Can script includes be used with Performance Analytics? I'm trying to use a dynamic filter on the indicator source and it calls a script include. In the "Preview" button I can see the filter is working -- however, when I run the data jobs, the filter doesn't work. Has anyone experienced something like this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2023 03:52 PM
In ServiceNow, a script include is a reusable script that can be used across multiple scripts, client scripts, and business rules. It contains functions that can be called from other scripts, and it helps to standardize and centralize the logic used in multiple scripts.
To ensure that a script include is loaded before a data job runs, you can add a "load" statement for the script include in the data job. The "load" statement loads the script include before the data job runs, making its functions available to the data job.
Here is an example of how to load a script include in a data job:
Open the data job in the ServiceNow platform.
In the data job form, locate the "Advanced" tab and click on it.
In the "Advanced" tab, locate the "Pre-processing script" field and click on the "Edit" button.
In the script editor, add a "load" statement for the script include at the beginning of the script. For example, if the script include is named "MyScriptInclude", the load statement would be:
gs.include("MyScriptInclude");
- Save the script and exit the script editor.
By adding the "load" statement for the script include in the pre-processing script of the data job, the script include will be loaded before the data is fetched and the filter is applied, making its functions available for use in the data job.
Please mark my answer correct/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal.
Thanks,
Punit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2023 08:19 AM
Hi Punit,
What table is this data job on? I'm not sure what data job you're referring to, as I don't see the Advanced tab on the PA job form. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2023 12:38 PM
Sorry for the confusion around the terms , but I mean to say a- In ServiceNow, a data job is a type of process that is used to perform large-scale data operations. Data jobs are typically used to automate tasks such as data imports, data exports, data transformations, and data migrations.
Refer attached screenshot, see highlighted section .
Please mark my answer correct/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal.
Thanks,
Punit