Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Cannot edit script ChangeSuccessScoreUtils which is designed to customize

SChu
Tera Contributor

Hi,

We have enabled Change Success Score feature for assignment groups and noticed that the interactive filter to show based on the assignment group is not working so I would like to override

sn_chg_score.ChangeSuccessScoreUtils method getDashboardURL to redirect to a custom dashboard so I can customize and fix the interactive filter. Any suggestions is much appreciated.
 

 

1 REPLY 1

Naveen20
ServiceNow Employee

 Find the UI Action that calls getDashboardURL and create your own with a higher order:

Step 1: Find the caller:

// Run in Scripts - Background
var tables = ['sys_ui_action', 'sys_script_include', 'sys_ui_page', 'sp_widget'];
tables.forEach(function(t) {
    var gr = new GlideRecord(t);
    gr.addQuery('script', 'CONTAINS', 'getDashboardURL');
    gr.query();
    while (gr.next())
        gs.info(t + ': ' + gr.getDisplayValue() + ' [' + gr.getUniqueValue() + ']');
});

Step 2: Create a new UI Action (same table, higher Order) that replaces the navigation:

// UI Action - onclick or server script
var dashboardId = 'YOUR_CUSTOM_DASHBOARD_SYS_ID';
var group = g_form.getValue('assignment_group');
var url = '$pa_dashboard.do?sysparm_dashboard=' + dashboardId 
        + '&sysparm_filter=assignment_group=' + group;
window.open(url, '_blank');

Set the condition to match the original UI Action's condition, and hide the original by adding a condition that always evaluates false (e.g., gs.getProperty('disable_ootb_css_link') == 'true' and set that property to true).