Donut charts disappeared on Overview section of the landing page on SOW in Xanadu Patch 5

nnguyen272
Tera Contributor

I have a customized landing page cloned from the OOTB one. The logic change in the SowIncidentLandingPageUtils UX Client Script Include is to add more donut charts. But after the upgrade the layout was broken and charts were not rendered in the layout (see attached screenshot).

 

Error message in console: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'context')
at ServiceDeskLandingPageUtils.getDonutConfig

 

Related property: api.context.session.user.roles

Related record: SowIncidentLandingPageUtilsSNC UX Client Script Include

 

Have any faced this issue before and had a resolution for it? I've searched about the property and seem that it can be called in client script. But I don't know why it was undefined.

 

Really appreciate your help on this matter!

5 REPLIES 5

Hi @Sumanth16 ,

 

It should be the "UpdateDonutsConfig" UX client script. The missing argument I mentioned earlier is "api".

...
const donutConfig = await landingPageUtils.getDonutConfig(helpers, 'your_work'); // old
const donutConfig = await landingPageUtils.getDonutConfig(helpers, 'your_work', api); //new
...

But it seems that ServiceNow has changed a small logic in the UX client script include "SowIncidentLandingPageUtilsSNC" from the Xanadu patch 9 release, which does not require the argument to be passed into the UX client script.

 

Here is the latest function extracted from the UX client script include:

static async getDonutConfig(helpers, mode, conditionalRecordCount,api) {
            var donutConfig = [];
            var visualizationConfig = await this.getVisualizationConfig(helpers, mode, conditionalRecordCount);

            for (var i = 0; i < visualizationConfig.length; i++) {
                var obj = {};
	        var visibility = api ? this.containsRole(api.context.session.user.roles, visualizationConfig[i]["roles"]) : true;
                if(visibility){ ... }

 

Hope this helps!

 

Best regards,

Ngoc Nguyen