Clarification on Service Operations workspace script include, on restricting users to landing page.

sugan1
Tera Contributor

Hi, 

I have duplicated a landing variant from Service Operations Workspace, in this the use case scenario is, if I'm the part of 'facilities' group, I should be able to see only the incidents or tasks assigned to 'facilities group'. The filter condition should be dynamic.

Pasting the screen shot for your better reference.

sugan1_0-1697455221277.png

 

Use case scenario is, there are 2 groups called 'IT' and 'Facilities' the logged in user should see only their group landing page and the reports related to their groups.

 

Also confirm how to hide 'Unassigned Group Tickets' from the report.

 

Confirm what changes should be made in the below script include. 

function include({
imports
}) {
let serviceDeskLandingPageUtilsSNC = imports['sn_sow_inc.SowIncidentLandingPageUtilsSNC']();

 

class ServiceDeskLandingPageUtils extends serviceDeskLandingPageUtilsSNC {

static getFieldMap() {
const fieldMap = {
'State': 'state',
'Priority': 'priority',
'Actual time left': 'time_left',
'Task type': 'sys_class_name'
};
return fieldMap;
}
static async getVisualizationConfig(helpers, mode, conditionalRecordCount = 0) {
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": "catalog_tasks",
"tableName": "task",
"tableDisplayValue": "Task",
"myWorkQuery": "sys_class_name=rm_story^ORsys_class_name=change_request^ORsys_class_name=sc_task^active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe",
"myTeamQuery": "sys_class_name=rm_story^ORsys_class_name=change_request^ORsys_class_name=sc_task^active=true^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": 'sow_landing_page',
"header": mode == 'your_work' ? await helpers.translate("Tasks assigned to you") : await helpers.translate("Tasks assigned to your team"),
"groupByField": "sys_class_name",
"evamId": evamDef["catalogTaskEvamDefinitionId"],
"updated_on": "^ORDERBYDESCsys_updated_on",
},

{
"id": "open_incidents",
"tableName": "task",
"tableDisplayValue": "Task",
"myWorkQuery": "active=true^sys_class_name=sc_task^ORsys_class_name=incident^assignment_groupISEMPTY",
"myTeamQuery": "active=true^sys_class_name=sc_task^ORsys_class_name=incident^assignment_groupISEMPTY",
"listView": 'sow_landing_page',
"header": await helpers.translate("Unassigned Group Tickets"),
"groupByField": "sys_class_name",
"evamId": evamDef['catalogTaskEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
},
{
"id": "unassigned_incidents",
"tableName": "task",
"tableDisplayValue": "Task",
"myWorkQuery": "sys_class_name=incident^ORsys_class_name=sc_task^active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"myTeamQuery": "sys_class_name=incident^ORsys_class_name=sc_task^active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744",
"listView": mode == "your_work" ? "sow_landing_page_assigned" : "sow_landing_page",
"header": await helpers.translate("Unassigned Tasks"),
"groupByField": "sys_class_name",
"evamId": evamDef['catalogTaskEvamDefinitionId'],
"updated_on": "^ORDERBYDESCsys_updated_on",
}
];

 

if (mode == 'your_work' && conditionalRecordCount > 0) {
const conditionalConfig = await this.getConditionalVisualizationConfig(helpers);
visualizationConfig.push(conditionalConfig);
}

 

return visualizationConfig;
}
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': 'Unassigned Catalog tasks',
'incident': 'Unassigned Incidents'
}
}
};

 

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;
}

 

 

Thanks,

Sugared

0 REPLIES 0