Service Operation workspace (SOW)

Ballela Siva Te
Tera Contributor

Hi,

In Service operation workspace(SOW) home page there is an option to select either Your work or Your Teams Work. By default Your work is showing up, but now client is requesting for Your teams work to be default.

 

Below is the script and necessary information :

 

BallelaSivaTe_0-1745922049146.png

 

 

 

Regards,

Siva Teja

1 ACCEPTED SOLUTION

@Ballela Siva Te PFB the updated 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": "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 you") : await helpers.translate("Incidents assigned to your 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 you") : await helpers.translate("Catalog tasks assigned to your team"),
                    "groupByField": "state",
                    "evamId": evamDef["catalogTaskEvamDefinitionId"],
                    "updated_on": "^ORDERBYDESCsys_updated_on",
                },
                {
                    "id": "changesAssigned",
                    "tableName": "change_request",
                    "tableDisplayValue": "Change Request",
                    "myWorkQuery": "active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
                    "myTeamQuery": "active=true^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
                    "listView": 'sow_landing_page',
                    "header": mode == 'your_work' ? await helpers.translate("Changes assigned to you") : await helpers.translate("Changes assigned to your team"),
                    "groupByField": "state",
                    "evamId": "27fbc1193b5c2a1059b0f61864e45ab3",
                    "updated_on": "^ORDERBYDESCsys_updated_on",
                }
            ];

            return visualizationConfig;

        }



        static async fetchTitle(table, selectedField, groupByField, groupMode = false) {
            console.log("calling SowIncidentLandingPageUtils");
            if (selectedField == undefined) {
                selectedField = 'all';
            }
            const labelMap = {
                'incident': {
                    'state': {
                        'all': 'Incidents',
                        '1': 'New incidents',
                        '2': 'In Progress incidents',
                        '3': 'On Hold incidents',
                        '6': 'Resolved incidents'
                    },
                    'priority': {
                        'all': 'Unassigned incidents',
                        '1': 'P1 unassigned incidents',
                        '2': 'P2 unassigned incidents',
                        '3': 'P3 unassigned incidents',
                        '4': 'P4 unassigned incidents',
                        '5': 'P5 unassigned incidents'
                    }
                },
                'sc_task': {
                    'state': {
                        'all': 'Catalog tasks',
                        '-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'
                    }
                },
                'change_request': {
                    'state': {
                        '-5': 'New Change Requests',
                        '-4': 'Assess Change Requests',
                        '-3': 'Authorize Change Requests',
                        '-2': 'Scheduled Change Requests',
                        '-1': 'Implement Change Requests',
                        '0': 'Review Change Requests',
                        '3': 'Closed Change Requests',
                        '4': 'Cancelled'
                    }
                }
            };

            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';
        }
        //------------------ADDED-------------------------------------------------
        static async getWorkPersonaConfig(helpers) {
            return {
                "items": [{
                        "id": "your_work",
                        "label": await helpers.translate("Your work")
                    },
                    {
                        "id": "your_team_work",
                        "label": await helpers.translate("Your team's work")
                    }
                ],
                "defaultSelected": ["your_team_work"]
            }
        }
        //------------------ADDED-------------------------------------------------

    }
    return ServiceDeskLandingPageUtils;
}

Regards,

Siva

View solution in original post

5 REPLIES 5

J Siva
Tera Sage

Hi @Ballela Siva Te 
1. Go to the below location (UX Client Script Include)

https://<instance-id>.service-now.com/sys_ux_client_script_include.do?sys_id=a1dcc9e7b77c3010e69dbc16de11a93b&sysparm_record_target=sys_ux_client_script_include&sysparm_record_row=1&sysparm_record_rows=1&sysparm_record_list=name%3DSowIncidentLandingPageUtils%5EORDERBYname

2. Add the below script to override the default value

static async getWorkPersonaConfig(helpers) {
    return {
        "items": [{
                "id": "your_work",
                "label": await helpers.translate("Your work")
            },
            {
                "id": "your_team_work",
                "label": await helpers.translate("Your team's work")
            }
        ],
        "defaultSelected": ["your_team_work"]
    }
}

 

JSiva_0-1745924931817.png

 

For more info visit: https://www.servicenow.com/community/service-operations-workspace/change-the-default-choice-of-the-s...

Regards,
Siva