PA Widgets Created by Script Not Showing in the Classic Dashboard Picker -- What Helped Me Fix It
New article articles in ServiceNow Community
·
Aug 17, 2026
·
article
PA Widgets Created by Script Not Showing in the Classic Dashboard Picker -- What Helped Me Fix It
Performance Analytics pa_widgets Dashboard Background Script GlideRecord
A Note Before I Start
I want to be upfront that I am not a Performance Analytics expert. I am a ServiceNow developer who ran into this problem recently and spent quite a bit of time trying to understand it. I searched the community, read through the product documentation, and tried several things before I finally found what was causing the issue in my instance.
I could not find a single place that covered all of this together, so I thought I would share what I learned in the hope that it saves someone else the same trouble. Please do add a comment if your experience was different or if you know of a better explanation -- I would genuinely love to learn more about this.
What I Was Trying to Do
I was adding yearly Performance Analytics score widgets to a classic dashboard for our Security Incident Response team. I cloned three quarterly PA widgets using a GlideRecord background script. The script ran without errors, the records appeared in pa_widgets, the indicators were linked, jobs were added, and historic data was collected.
But when I opened the dashboard editor and tried to add the widgets through the picker (Performance Analytics > Score), three of my four new widgets simply were not there. The fourth widget -- which I had created through the PA UI some time ago -- showed up perfectly fine.
Same scope, same application, same indicator type. The UI-created one was visible. The three script-created ones were not.
Quick thing to try first: Before reading further, try searching for the name of the source widget (the one you cloned from) in the picker. In my case, the new widgets were actually there -- just listed under the wrong name. If you find them that way, the first section below should help.
Thing 1: The lookup_name Field
This turned out to be the main issue for me, and honestly I had never paid attention to this field before.
The pa_widgets table has two name-related fields:
- name -- the internal record label
- lookup_name -- what actually gets displayed in the dashboard widget picker
My script copied all non-system fields from the source widget using a field loop. That loop also copied lookup_name from the source. So while the name field correctly said "Yearly Detection," the lookup_name still said "Quarterly Detection."
The picker displays lookup_name, not name. So when I searched for "Yearly" in the picker, I found nothing -- because my three new widgets were sitting there the whole time, just listed under "Quarterly Detection," "Quarterly Response," and "Quarterly Resolution."
How to Check
Open the widget record directly and look at the Lookup name field:
https://<your-instance>.service-now.com/pa_widgets.do?sys_id=<your_widget_sys_id>
If it shows the name of the source widget rather than your new widget's name, that is likely the reason it is not showing up where you expect it.
What worked for me: I updated the lookup_name field on the widget record to match the correct name, saved it, cleared the platform cache at cache.do, and then the widgets appeared in the picker as expected.
Preventing This in a Clone Script
If you are writing a script that clones widgets, I would suggest adding lookup_name to your SKIP_FIELDS list and then setting it explicitly after the copy:
var SKIP_FIELDS = {
'sys_id': true, 'lookup_name': true, /* ... other fields ... */
};
// After copyFields(), set both name fields explicitly:
newWid.setValue('name', cfg.newWidgetName);
newWid.setValue('lookup_name', cfg.newWidgetName);
Thing 2: The pa_widget_indicators Junction Table (Worth Checking, But I Am Not Fully Certain)
I want to be careful about how I present this one, because I am not fully sure of its role in the picker issue.
While I was investigating, I noticed that all three missing widgets had no record in the pa_widget_indicators junction table. This table links a widget to its indicator. When you create a widget through the PA UI, a record in this table appears to be created automatically. When you insert a widget via GlideRecord in a script, it is not.
The honest truth is that I fixed the lookup_name field and created the missing pa_widget_indicators records at the same time, so I cannot say which of those two changes made the widgets appear in the picker -- or whether both were needed together. I am including this here because the junction records were definitely missing and should exist, and it is worth checking if you are in a similar situation. But I would not want anyone to treat this as a confirmed fix on its own.
If you have tested this in isolation and can share what you found, I would really appreciate hearing about it in the comments.
How to Check
https://<your-instance>.service-now.com/pa_widget_indicators.do?sysparm_query=widget=<your_widget_sys_id>
If no records are returned, the junction entry is missing for that widget.
How to create the missing record:
var ji = new GlideRecord('pa_widget_indicators');
ji.initialize();
ji.setValue('widget', '<widget_sys_id>');
ji.setValue('indicator', '<indicator_sys_id>');
ji.insert();
Adding This to a Clone Script as a Precaution
Even if its effect on the picker is uncertain, it is probably good practice to always create this junction record when inserting a widget via script:
var newWidId = newWid.insert();
if (newWidId) {
var ji = new GlideRecord('pa_widget_indicators');
ji.initialize();
ji.setValue('widget', newWidId);
ji.setValue('indicator', newIndId);
ji.insert();
}
Thing 3: Application Scope Mismatch
This one is already covered in a few other community threads, but I am including it here so everything is in one place.
The widget picker filters by application scope. If the widget's sys_scope does not match the scope the dashboard editor is running in, the widget will not appear in the picker even if everything else looks correct.
How to Check
Check the sys_scope field on both the pa_widgets record and the pa_dashboards record. They should match.
What worked for others: Switch the application scope in the top-right Navigator banner to match the widget's scope, then reopen the dashboard editor and try the picker again.
A Diagnostic Script That Might Help
I put together this read-only script to check all three things at once. You can run it in the background script console. Just replace the sys_id at the top with your widget's sys_id.
// READ ONLY - PA widget picker diagnostic
// Replace WIDGET_SYS_ID with your pa_widgets sys_id
var WIDGET_SYS_ID = 'your_sys_id_here';
var wid = new GlideRecord('pa_widgets');
if (!wid.get(WIDGET_SYS_ID)) {
gs.info('Widget not found in pa_widgets - please check the sys_id');
} else {
gs.info('--- pa_widgets record ---');
gs.info('name = ' + wid.getValue('name'));
gs.info('lookup_name = ' + wid.getValue('lookup_name'));
gs.info('type = ' + wid.getValue('type'));
gs.info('indicator = ' + wid.getValue('indicator'));
gs.info('sys_scope = ' + wid.getDisplayValue('sys_scope'));
gs.info('');
gs.info('--- pa_widget_indicators junction ---');
var ji = new GlideRecord('pa_widget_indicators');
ji.addQuery('widget', WIDGET_SYS_ID);
ji.query();
if (ji.next()) {
gs.info('FOUND: sys_id=' + ji.getUniqueValue() + ' | indicator=' + ji.getValue('indicator'));
} else {
gs.info('MISSING - no junction record found for this widget');
}
}
Things I Investigated That Were Not the Issue (For Me)
I want to share what I went down a rabbit hole on, just in case it saves you from doing the same:
- No scores / historic data not collected: I thought at first that maybe the picker only shows widgets that already have score data. In my case, that turned out not to be true -- the picker showed my UI-created widget even before jobs had run for it. Not having scores just means the widget will say "no data" after you add it, but it still appears in the picker.
- active field on pa_widgets: Some articles I found mentioned an
activefield on widgets that controls picker visibility. When I checked our instance, this field appeared to be null on both the working widget and the non-working ones. Setting it to true did not seem to make a difference for us. I am honestly not sure whether this field behaves differently on other instances or ServiceNow versions -- so it may be worth checking, but it was not the cause for me.
Quick Summary
If your script-created PA widgets are not appearing in the classic dashboard picker, these are the three things I would suggest checking:
| # | What to Check | Where to Look | Might Apply If... |
|---|---|---|---|
| 1 | lookup_name is set to the correct new name |
pa_widgets record directly | You cloned from an existing widget using a field copy |
| 2 | A record exists in pa_widget_indicators |
pa_widget_indicators, filter by widget sys_id | Widget was inserted via GlideRecord in any script |
| 3 | Application scope matches between widget and dashboard | sys_scope on pa_widgets and pa_dashboards | Script ran in a different scope than expected |
Both the first and second items seem to apply whenever a pa_widgets record is created by script rather than through the PA UI. If you are building a clone or bulk-create script, it may be worth handling both of these proactively so you do not run into this after the fact.
I hope this is useful to someone. If you have run into this problem and found a different cause or a better explanation, please do share it in the comments -- I am still learning and would appreciate any additional insight the community can offer.
Thank you for reading.
Tested on: Zurich | Tables referenced: pa_widgets, pa_widget_indicators, pa_cubes, pa_indicators | Roles needed for the diagnostic script: background_script_executor or admin
https://www.servicenow.com/community/platform-analytics-articles/pa-widgets-created-by-script-not-showing-in-the-classic/ta-p/3588167