The CreatorCon Call for Content is officially open! Get started here.

Create Widget data grid and button in UI builder

Sam M
Tera Contributor

Hi,
I'm trying to replicate a workspace similar to the "Service Operation Workspace", but I'm unsure how to create a Widget Data Grid that can display and reflect data from the Donut Chart (as seen in the picture). Is there a specific component for this? Additionally, I'd like to know how to create a button that allows users to switch between group data. Any help or suggestions would be greatly appreciated.

SamM_0-1695610956515.png

SamM_1-1695611022658.png

 

 

3 REPLIES 3

mmeazza
Tera Contributor

Hi Sam,

I don’t know if you’re still looking for a way to do this – if that’s the case I hope the following links can help:

How to add additonal reports to Service Operations Workspace (SOW) homepage - Support and Troublesho...

Solved: Re: Please help me configure the use case in Servi... - ServiceNow Community

Modify the donut cards in the Overview section (servicenow.com)

From what I could understand, the “simpler” way to do this is to duplicate the OOTB page and then to proceed with your customizations.

Furthermore, these two UX Script Includes have a lot of info about the components and the data that’s displayed on the page: SowIncidentLandingPageUtils and SowIncidentLandingPageUtilsSNC.

Hope it helps!

Haseeb-Ahmed
ServiceNow Employee
ServiceNow Employee

Hi @Sam M ,

1. OOTB landing page uses EVAM component to create card's grid, you may follow below doc and search for similar resources for EVAM component

https://docs.servicenow.com/bundle/washingtondc-servicenow-platform/page/administer/evam/concept/eva...

2. OOTB landing page implementation is covered in details in the below document

https://www.servicenow.com/community/itsm-articles/configuration-activities-for-service-operations-w...

3. For switching between groups you may use dropdown component and on dropdown value selection can dynamically pass visualization component(donut) query to load different data 

 

Please mark it helpful, if it answers your query.

Thanks,
Haseeb Ahmed

 

 

Sivani6064
Tera Contributor

Hii

 

Here is the procedure to list the data based the visualization selected dynamically.

 

1. First  "Enable Drilldown"

  1. In the Donut Visualization Component  "Configure" tab.
  2. Under "Data Update" Section. Toggle the "Enable Drilldown". (which makes to store the selected visualization data in an event [Visualization Item Selected] ).enable drilldown.png

2. In the "Events" Tab.

  1. The "Visualization Item Selected" event only stores the Grouped By value. For ex: if report is grouped by state then it stores it display value you have selected.  
  2. {value: 6, elements: Array(1), groupBy: Array(1), color: undefined, cssColor: undefined}
  3. And stores the count of records. 
  4. We can also extract the "title" of the report.
  5. Based on the title, State (Group By), i have dynamically build query using client scripts.
Here is the code:
function handler({ api, event, helpers, imports }) {
var states = {
incident: [
{ id: "1", label: "New" },
{ id: "2", label: "In Progress" },
{ id: "3", label: "On Hold" },
{ id: "6", label: "Resolved" },
{ id: "7", label: "Closed" },
{ id: "8", label: "Canceled" }
],
sc_task: [
{ id: "1", label: "Open" },
{ id: "2", label: "Work in Progress" },
{ id: "-5", label: "Pending" },
{ id: "3", label: "Closed Complete" },
{ id: "4", label: "Closed Incomplete" },
{ id: "7", label: "Closed Skipped" }
],
task_sla: [
{ id: "achieved", label: "Achieved" },
{ id: "completed", label: "Completed" },
{ id: "breached", label: "Breached" },
{ id: "cancelled", label: "Cancelled" },
{ id: "paused", label: "Paused" },
{ id: "in_progress", label: "In progress" }
]
};

// 1️⃣ Use local variable for table instead of relying on state updates immediately
var table;
if (api.state.title === 'Catalog tasks assigned to you' || api.state.title === 'Catalog tasks assigned to your team') {
table = 'sc_task';
} else if (api.state.title === 'Incident SLAs' || api.state.title === 'Incident SLAs Team') {
table = 'task_sla';
} else {
table = 'incident';
}

// Store in state AFTER for consistency
api.setState('table', table);

// 2️⃣ Use local variable for match
var displayState = api.state.test.elements[0];
var match = states[table].find(function(item) {
return item.label === displayState;
});

if (match) {
api.setState('state', match.id);
}

// 3️⃣ Use table & match.id directly — not re-reading state
var filter = '';
if (table === 'incident') {
if (api.state.title === 'Incidents assigned to you') {
filter = 'assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^state=' + Number(match.id);
} else if (api.state.title === 'Incidents assigned to your team') {
filter = 'assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^state=' + Number(match.id);
} else if (api.state.title === 'Unassigned incidents') {
filter = 'assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^assigned_toISEMPTY^state=' + Number(match.id);
}
} else if (table === 'sc_task') {
if (api.state.title === 'Catalog tasks assigned to you') {
filter = 'assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^state=' + Number(match.id);
} else if (api.state.title === 'Catalog tasks assigned to your team') {
filter = 'assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^assigned_toISEMPTY^state=' + Number(match.id);
}
} else if (table === 'task_sla') {
if (api.state.title === 'Incident SLAs') {
filter = 'task.assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^stage=' + match.id;
} else if (api.state.title === 'Incident SLAs Team') {
filter = 'task.assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^stage=' + match.id;
}
}

// 4️⃣ Finally set query
api.setState('query', filter);
}
 

----->Here, we have set the "dynamic filter" value in client state parameter - query.

 

3. Below the report component, select the List Component in the component properties give table and filter(client state parameter).