SOW - customise visualization charts

Hariskanthini
Tera Contributor

We are using Service Operations Workspace and in carousel, we are displaying a number of data visualization donut charts. We are getting the input from SowIncidentLandingPageUtils. The requirement is to customize the page based on the logged in user's group. We are currently showing charts from incident, change and problem table. If the user belongs to incident group, only incident charts should be shown. Similarly, for change.

 

I tried to pass a parameter from the client script but it is not accepting in the function. Please help me on how this can be achieved!

Client script:

 

/**
 * @Param {params} params
 * @Param {api} params.api
 * @Param {any} params.event
 * @Param {any} params.imports
 * @Param {ApiHelpers} params.helpers
 */
async function handler({
    api,
    event,
    helpers,
    imports
}) {
    
    const landingPageUtils = imports['sn_sow_inc.SowIncidentLandingPageUtils']();
    
    const conditionalVizConfig = await landingPageUtils.getConditionalVisualizationConfig(helpers);
    //const conditionalVizConfig = JSON.parse('answer');
    api.setState("conditionalVizConfig", conditionalVizConfig[0]);

    
    //const conditionalVizConfig = await landingPageUtils.getConditionalVisualizationConfig(helpers);
    //api.setState("conditionalVizConfig", conditionalVizConfig);
}

 

 

 

 

1 ACCEPTED SOLUTION

Haseeb-Ahmed
ServiceNow Employee
ServiceNow Employee

Hi @Hariskanthini ,

You may follow the below steps

1. Add a new transform data broker to fetch current user's groups (refer to screenshot, a ACL will be required for the new data broker)

DataBroker.png

2. Remove the UpdateDonutsConfig client script from the Page ready event, and then add the UpdateDonutsConfig client script on the new data broker's  Data fetch succeeded event (refer to screenshot)

Existing script binding on page load.pngAdd client script on data broker success.png

3. Update the UpdateDonutsConfig client script to filter donut configs based on the fetched groups(refer to the screenshot)Update client script to filter config based on groups.png

 

Please mark it helpful, if it answers your query.

Thanks,
Haseeb Ahmed

View solution in original post

2 REPLIES 2

Haseeb-Ahmed
ServiceNow Employee
ServiceNow Employee

Hi @Hariskanthini ,

You may follow the below steps

1. Add a new transform data broker to fetch current user's groups (refer to screenshot, a ACL will be required for the new data broker)

DataBroker.png

2. Remove the UpdateDonutsConfig client script from the Page ready event, and then add the UpdateDonutsConfig client script on the new data broker's  Data fetch succeeded event (refer to screenshot)

Existing script binding on page load.pngAdd client script on data broker success.png

3. Update the UpdateDonutsConfig client script to filter donut configs based on the fetched groups(refer to the screenshot)Update client script to filter config based on groups.png

 

Please mark it helpful, if it answers your query.

Thanks,
Haseeb Ahmed

Thank you so much for your detailed solution!