Please help me configure the use case in Service Operations Workspace

Shwetha Shenoy
Tera Expert

How should I configure/modify the first-level cards in the overview section in the service operations workspace?

Use Case : 

To add reports named - Task Assigned & many more

I am able to add the rest of the reports successfully by modifying the SowIncidentLandingPageUtils (i.e. UX Client Script Include). But when it comes to Task Assigned I am unable to group it by state. 

 

Please find the below script and the reports rendered :

The reports  :

(When I click on the View all button it renders correctly but when I click the blue or yellow colour on the tasks assigned to my team report it isn't rendering the list view correctly (i.e. group by state).

 

Screenshot 2023-09-30 at 10.01.01 PM.png

 

Screenshot 2023-09-30 at 10.03.36 PM.png

 

The script : 

function include({imports}) {
let serviceDeskLandingPageUtilsSNC = imports['sn_sow_inc.SowIncidentLandingPageUtilsSNC']();
class ServiceDeskLandingPageUtils extends serviceDeskLandingPageUtilsSNC {
static async getVisualizationConfig(helpers, mode) {
const evamDef = this.getEvamDef();
const visualizationConfig = [
{
"id": "task_assigned",
"tableName": "task",
"tableDisplayValue": "Task",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assigned_toISNOTEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": mode == 'your_work' ? await helpers.translate("Tasks assigned to me") : await helpers.translate("tasks assigned to my team"),
"groupByField": "state",
"evamId": "615d205d94df0110f87765e94545da03",
"updated_on": "^ORDERBYDESCsys_updated_on",
},
{
"id": "incident_assigned",
"tableName": "incident",
"tableDisplayValue": "Incident",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assigned_toISNOTEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": mode == 'your_work' ? await helpers.translate("Incidents assigned to me") : await helpers.translate("Incidents assigned to my team"),
"groupByField": "state",
"evamId": evamDef['incidentEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
},

{
"id": "incident_sla",
"tableName": "task_sla",
"tableDisplayValue": "Task SLA",
"myWorkQuery": "task.sys_class_name=incident^task.assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^task.active=true^sla.type=SLA^ORsla.type=OLA^active=true^time_left<=1970-01-08 00:00:00",
"myTeamQuery": "task.sys_class_name=incident^task.assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^task.active=true^sla.type=SLA^ORsla.type=OLA^active=true^time_left<=1970-01-08 00:00:00",
"listView": 'sow_landing_page',
"header": await helpers.translate("Incident SLAs"),
"groupByField": "time_left",
"evamId": evamDef['incidentSlaEvamDefinitionId'],
"updated_on": "^ORDERBYtime_left",
},
{
"id": "unassigned_incidents",
"tableName": "incident",
"tableDisplayValue": "Incident",
"myWorkQuery": "active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"myTeamQuery": "active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": await helpers.translate("Unassigned incidents"),
"groupByField": "priority",
"evamId": evamDef['incidentEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
},
{
"id": "catalog_tasks",
"tableName": "sc_task",
"tableDisplayValue": "Catalog Task",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": 'sow_landing_page',
"header": mode == 'your_work' ? await helpers.translate("Catalog tasks assigned to me") : await helpers.translate("Catalog tasks assigned to my team"),
"groupByField": "state",
"evamId": evamDef["catalogTaskEvamDefinitionId"],
"updated_on": "^ORDERBYDESCsys_updated_on",
}
];
return visualizationConfig;
}
}
return ServiceDeskLandingPageUtils;
}

 

Please help me to configure it as required.

Thanks in advance.

2 ACCEPTED SOLUTIONS

Hi @Shwetha Shenoy ,

I found the issue, try the following code in UX Client Script Include.

function include({imports}) {
let serviceDeskLandingPageUtilsSNC = imports['sn_sow_inc.SowIncidentLandingPageUtilsSNC']();
class ServiceDeskLandingPageUtils extends serviceDeskLandingPageUtilsSNC {
static async getVisualizationConfig(helpers, mode) {
const evamDef = this.getEvamDef();
const visualizationConfig = [
{
"id": "task_assigned",
"tableName": "task",
"tableDisplayValue": "Task",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assigned_toISNOTEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": mode == 'your_work' ? await helpers.translate("Tasks assigned to me") : await helpers.translate("tasks assigned to my team"),
"groupByField": "state",
"evamId": "615d205d94df0110f87765e94545da03",
"updated_on": "^ORDERBYDESCsys_updated_on",
},
{
"id": "incident_assigned",
"tableName": "incident",
"tableDisplayValue": "Incident",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assigned_toISNOTEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": mode == 'your_work' ? await helpers.translate("Incidents assigned to me") : await helpers.translate("Incidents assigned to my team"),
"groupByField": "state",
"evamId": evamDef['incidentEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
},

{
"id": "incident_sla",
"tableName": "task_sla",
"tableDisplayValue": "Task SLA",
"myWorkQuery": "task.sys_class_name=incident^task.assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^task.active=true^sla.type=SLA^ORsla.type=OLA^active=true^time_left<=1970-01-08 00:00:00",
"myTeamQuery": "task.sys_class_name=incident^task.assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^task.active=true^sla.type=SLA^ORsla.type=OLA^active=true^time_left<=1970-01-08 00:00:00",
"listView": 'sow_landing_page',
"header": await helpers.translate("Incident SLAs"),
"groupByField": "time_left",
"evamId": evamDef['incidentSlaEvamDefinitionId'],
"updated_on": "^ORDERBYtime_left",
},
{
"id": "unassigned_incidents",
"tableName": "incident",
"tableDisplayValue": "Incident",
"myWorkQuery": "active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"myTeamQuery": "active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": await helpers.translate("Unassigned incidents"),
"groupByField": "priority",
"evamId": evamDef['incidentEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
},
{
"id": "catalog_tasks",
"tableName": "sc_task",
"tableDisplayValue": "Catalog Task",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": 'sow_landing_page',
"header": mode == 'your_work' ? await helpers.translate("Catalog tasks assigned to me") : await helpers.translate("Catalog tasks assigned to my team"),
"groupByField": "state",
"evamId": evamDef["catalogTaskEvamDefinitionId"],
"updated_on": "^ORDERBYDESCsys_updated_on",
}
];
return visualizationConfig;
}

static async fetchTitle(table, nameValueMap, groupByLabel, groupMode = false) {
            const groupByField = this.getFieldMap()[groupByLabel];
            return this.getLabelMaps(table, nameValueMap[groupByField], groupByField, groupMode);
        }

        static getLabelMaps(table, selectedField, groupByField, groupMode = false) {
            const labelMap = {
                'incident': {
                    'state': {
                        '1': 'New incidents',
                        '2': 'In Progress incidents',
                        '3': 'On Hold incidents',
                        '6': 'Resolved incidents'
                    },
                    'priority': {
                        '1': 'P1 unassigned incidents',
                        '2': 'P2 unassigned incidents',
                        '3': 'P3 unassigned incidents',
                        '4': 'P4 unassigned incidents',
                        '5': 'P5 unassigned incidents'
                    }
                },
                'sc_task': {
                    'state': {
                        '-5': 'Pending catalog tasks',
                        '1': 'Open catalog tasks',
                        '2': 'Work in progress catalog tasks'
                    }
                },
                'task': {
                    'sys_class_name': {
                        'sc_task': 'Catalog tasks delegated to you',
                        'incident': 'Incidents delegated to you'
                    },
 'state': {
                        '-5': 'Pending',
                        '1': 'Open',
                        '2': 'Work in progress'
                    }
                }
            };

            if((table == 'incident' && groupByField == 'priority') || table == 'task')
                return labelMap[table][groupByField][selectedField];

            if (groupMode)
                return labelMap[table][groupByField][selectedField] + ' assigned to your team';
            return labelMap[table][groupByField][selectedField] + ' assigned to you';
        }

}
return ServiceDeskLandingPageUtils;
}

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

View solution in original post

@Shwetha Shenoy What I found is, the OOTB UX Client Script Include doesn't contain any label maps for state field, so I added the following label maps in  getLabelMaps function, you can try adding all the state values that you are expecting and try once again after clearing the browser cache and instance cache if possible.

'state': {
                        '-5': 'Pending',
                        '1': 'Open',
                        '2': 'Work in progress'
                    }

 

Thanks,
Anvesh

View solution in original post

8 REPLIES 8

AnveshKumar M
Tera Sage
Tera Sage

Hi @Shwetha Shenoy 

Can you share your EVAM configuration for the Task? Rest all seems to be fine from script perspective.

Thanks,
Anvesh

Hi  @AnveshKumar M,

Are you talking about this EVAM Definition for the task?

 

Screenshot 2023-10-01 at 8.27.23 PM.png

Hi @Shwetha Shenoy ,

I found the issue, try the following code in UX Client Script Include.

function include({imports}) {
let serviceDeskLandingPageUtilsSNC = imports['sn_sow_inc.SowIncidentLandingPageUtilsSNC']();
class ServiceDeskLandingPageUtils extends serviceDeskLandingPageUtilsSNC {
static async getVisualizationConfig(helpers, mode) {
const evamDef = this.getEvamDef();
const visualizationConfig = [
{
"id": "task_assigned",
"tableName": "task",
"tableDisplayValue": "Task",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assigned_toISNOTEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": mode == 'your_work' ? await helpers.translate("Tasks assigned to me") : await helpers.translate("tasks assigned to my team"),
"groupByField": "state",
"evamId": "615d205d94df0110f87765e94545da03",
"updated_on": "^ORDERBYDESCsys_updated_on",
},
{
"id": "incident_assigned",
"tableName": "incident",
"tableDisplayValue": "Incident",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assigned_toISNOTEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": mode == 'your_work' ? await helpers.translate("Incidents assigned to me") : await helpers.translate("Incidents assigned to my team"),
"groupByField": "state",
"evamId": evamDef['incidentEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
},

{
"id": "incident_sla",
"tableName": "task_sla",
"tableDisplayValue": "Task SLA",
"myWorkQuery": "task.sys_class_name=incident^task.assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^task.active=true^sla.type=SLA^ORsla.type=OLA^active=true^time_left<=1970-01-08 00:00:00",
"myTeamQuery": "task.sys_class_name=incident^task.assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744^task.active=true^sla.type=SLA^ORsla.type=OLA^active=true^time_left<=1970-01-08 00:00:00",
"listView": 'sow_landing_page',
"header": await helpers.translate("Incident SLAs"),
"groupByField": "time_left",
"evamId": evamDef['incidentSlaEvamDefinitionId'],
"updated_on": "^ORDERBYtime_left",
},
{
"id": "unassigned_incidents",
"tableName": "incident",
"tableDisplayValue": "Incident",
"myWorkQuery": "active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"myTeamQuery": "active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": await helpers.translate("Unassigned incidents"),
"groupByField": "priority",
"evamId": evamDef['incidentEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
},
{
"id": "catalog_tasks",
"tableName": "sc_task",
"tableDisplayValue": "Catalog Task",
"myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "active=true^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": 'sow_landing_page',
"header": mode == 'your_work' ? await helpers.translate("Catalog tasks assigned to me") : await helpers.translate("Catalog tasks assigned to my team"),
"groupByField": "state",
"evamId": evamDef["catalogTaskEvamDefinitionId"],
"updated_on": "^ORDERBYDESCsys_updated_on",
}
];
return visualizationConfig;
}

static async fetchTitle(table, nameValueMap, groupByLabel, groupMode = false) {
            const groupByField = this.getFieldMap()[groupByLabel];
            return this.getLabelMaps(table, nameValueMap[groupByField], groupByField, groupMode);
        }

        static getLabelMaps(table, selectedField, groupByField, groupMode = false) {
            const labelMap = {
                'incident': {
                    'state': {
                        '1': 'New incidents',
                        '2': 'In Progress incidents',
                        '3': 'On Hold incidents',
                        '6': 'Resolved incidents'
                    },
                    'priority': {
                        '1': 'P1 unassigned incidents',
                        '2': 'P2 unassigned incidents',
                        '3': 'P3 unassigned incidents',
                        '4': 'P4 unassigned incidents',
                        '5': 'P5 unassigned incidents'
                    }
                },
                'sc_task': {
                    'state': {
                        '-5': 'Pending catalog tasks',
                        '1': 'Open catalog tasks',
                        '2': 'Work in progress catalog tasks'
                    }
                },
                'task': {
                    'sys_class_name': {
                        'sc_task': 'Catalog tasks delegated to you',
                        'incident': 'Incidents delegated to you'
                    },
 'state': {
                        '-5': 'Pending',
                        '1': 'Open',
                        '2': 'Work in progress'
                    }
                }
            };

            if((table == 'incident' && groupByField == 'priority') || table == 'task')
                return labelMap[table][groupByField][selectedField];

            if (groupMode)
                return labelMap[table][groupByField][selectedField] + ' assigned to your team';
            return labelMap[table][groupByField][selectedField] + ' assigned to you';
        }

}
return ServiceDeskLandingPageUtils;
}

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

Hi @AnveshKumar M ,

Still, the issue pertains.

 

When I click on the View all button it renders correctly but when I click the blue or yellow colour on the tasks assigned to my team report it isn't rendering the list view correctly (i.e. group by state)

Thanks !