diff --git a/Modern Development/Service Portal Widgets/Open in Platform/README.md b/Modern Development/Service Portal Widgets/Open in Platform/README.md index 0104fafdd2..d80671260b 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/README.md +++ b/Modern Development/Service Portal Widgets/Open in Platform/README.md @@ -1,6 +1,19 @@ **This is an enhancement to the current code** -1. Added "open in SOW" Button to open the record in service operations workspace, since it is gaining popularity now. +1. Added "open in Workspace" Button to open the record in workspace(defined in option schema), since it is gaining popularity now. 2. Enhanced the visibility condition so that the button is only visible on pages having sys_id and table in url. 3. Enhanced css to improve visibility of button. +4. This button wll look for the table to workspace mapping (in option schema) and create the URL to open record in respective workspace. If now mapping is found, the record is opened in SOW workspace(default). +5. The button name has been changed to generic title "Open In Workspace" -Widget will create a button that will only be visable to users with the itil role that will take them to the same record in platform. will work with the form and standard ticket pages (or anywhere with the table and sysId in the url. +**Sample** +{ +"name":"define_workspace", +"type":"json", +"label":"Define Table Workspace JSON Mapping", +"value":{ + "sn_grc_issue":"risk/privacy", // will open issue records in RISK workspace + "sn_si_incident":"sir" // will open security incidents in SIR workspace. +} +} + +Widget will create a button that will only be visible to users with the itil role that will take them to the same record in platform. will work with the form and standard ticket pages (or anywhere with the table and sysId in the url. diff --git a/Modern Development/Service Portal Widgets/Open in Platform/body.html b/Modern Development/Service Portal Widgets/Open in Platform/body.html index 7e005923dc..c1e1537cd6 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/body.html +++ b/Modern Development/Service Portal Widgets/Open in Platform/body.html @@ -1,6 +1,6 @@
diff --git a/Modern Development/Service Portal Widgets/Open in Platform/option schema.js b/Modern Development/Service Portal Widgets/Open in Platform/option schema.js index 825d260ce8..fad9e8ec71 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/option schema.js +++ b/Modern Development/Service Portal Widgets/Open in Platform/option schema.js @@ -6,9 +6,18 @@ "default_value":"Open in Platform" }, { -"name":"open_in_sow", +"name":"open_in_workspace", "type":"string", -"label":"Name for SOW Button", -"default_value":"Open in SOW" +"label":"Name for Workspace Button", +"default_value":"Open In workspace" +}, +{ +"name":"define_workspace", +"type":"json", +"label":"Define Table Workspace JSON Mapping", +"value":{ + "sn_grc_issue":"risk/privacy", + "sn_si_incident":"sir" +} } ] diff --git a/Modern Development/Service Portal Widgets/Open in Platform/server.js b/Modern Development/Service Portal Widgets/Open in Platform/server.js index a37e738081..0ebc6927c3 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/server.js +++ b/Modern Development/Service Portal Widgets/Open in Platform/server.js @@ -1,13 +1,19 @@ (function() { /* - Code will get table and sys_id parameter from url and create url for platform and sow. + Code will get table and sys_id parameter from url and create url for platform and workspace(defined in option schema). This widget can be used in any page having sys_id and table in url , eg: ticket page. */ - data.table = input.table || $sp.getParameter("table"); // get table from url - data.sys_id = input.sys_id || $sp.getParameter("sys_id"); // get sys_id from url + data.table = $sp.getParameter("table"); // get table from url + data.sys_id = $sp.getParameter("sys_id"); // get sys_id from url + var tableWorkspaceMapping = JSON.parse(options.define_workspace); // get the table to workspace mapping from instance options. + Object.keys(tableWorkspaceMapping).forEach(function(key) { + if (key == data.table) + data.workspace_url = "now/" + tableWorkspaceMapping[key] + "/record/" + data.table + "/" + data.sys_id; // if table to workspce mapping is found, the create workspace URL. + else + data.workspace_url = "now/sow/record/" + data.table + "/" + data.sys_id; // open in SOW + }); data.platform_url = "/nav_to.do?uri=" + data.table + ".do?sys_id=" + data.sys_id; - data.sow_url = "now/sow/record/" + data.table + "/" + data.sys_id; data.role = false; if (gs.hasRole("itil") && data.table && data.sys_id) { // only visible to users with itil role and if url has required parameters.