Can you Copy a Widget with all the attached Indicators?

Mikuro
Tera Expert

Hello,

Is there a way to copy/clone a PA widget in it's entirety? Insert and Stay copies the widget, but not with the indicators attached. Looking for something like 'Insert and Stay with Relations' that Automated Indicators have.

Reason:
Setting up SLA Dashboards and I've been asked to create multiple tabs with List Scorecard views, 4 of them per tab * 3 tabs (Monthly/Weekly/Daily) = 12 Widgets each that have anywhere between 4-16 Indicators. I have 9 different Dashboards I need to do this for and it's becoming extremely tedious manually adding the indicators to each widget. Indicator groups is a no go as I need to customize the label and order on each one added to the widget.

Thanks!

1 ACCEPTED SOLUTION

Aaron Munoz
Tera Guru

You can create a UI Action visible on the form of table pa_widgets with the following code:

doInsertWithIndicators();
function doInsertWithIndicators() {
  var originalWidget = current.sys_id.toString();
  var newWidget = current;
  var id = current.setNewGuid();
  var indicators = new GlideRecord('pa_widget_indicators');
  indicators.addQuery('widget', originalWidget);
  indicators.query();
  while (indicators.next()) {
    indicators.widget = id;
    indicators.insert();
  }
  current.insert();
  action.setRedirectURL(newWidget);
}

View solution in original post

2 REPLIES 2

Slawek_Radziewi
Kilo Sage

If you need the same widget you can just add it from picker by name. 

 

Aaron Munoz
Tera Guru

You can create a UI Action visible on the form of table pa_widgets with the following code:

doInsertWithIndicators();
function doInsertWithIndicators() {
  var originalWidget = current.sys_id.toString();
  var newWidget = current;
  var id = current.setNewGuid();
  var indicators = new GlideRecord('pa_widget_indicators');
  indicators.addQuery('widget', originalWidget);
  indicators.query();
  while (indicators.next()) {
    indicators.widget = id;
    indicators.insert();
  }
  current.insert();
  action.setRedirectURL(newWidget);
}