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 ec67b8ff50..0104fafdd2 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/README.md +++ b/Modern Development/Service Portal Widgets/Open in Platform/README.md @@ -1,3 +1,6 @@ -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. +**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. +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. -see also [on Share](https://developer.servicenow.com/connect.do#!/share/contents/6592535_open_in_platform_widget?t=PRODUCT_DETAILS) +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. 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 507dbb3fc9..7e005923dc 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/body.html +++ b/Modern Development/Service Portal Widgets/Open in Platform/body.html @@ -1,5 +1,6 @@
diff --git a/Modern Development/Service Portal Widgets/Open in Platform/css.js b/Modern Development/Service Portal Widgets/Open in Platform/css.js new file mode 100644 index 0000000000..ed4e26f29a --- /dev/null +++ b/Modern Development/Service Portal Widgets/Open in Platform/css.js @@ -0,0 +1,7 @@ +/* +This styling will align buttons on 2 ends of the div. +*/ +.btn-cntr{ +display: flex; +justify-content: space-between; +} 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 new file mode 100644 index 0000000000..825d260ce8 --- /dev/null +++ b/Modern Development/Service Portal Widgets/Open in Platform/option schema.js @@ -0,0 +1,14 @@ +[ +{ +"name":"open_in_platform", +"type":"string", +"label":"Name for Plarform Button", +"default_value":"Open in Platform" +}, +{ +"name":"open_in_sow", +"type":"string", +"label":"Name for SOW Button", +"default_value":"Open in SOW" +} +] 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 f94e939a90..a37e738081 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/server.js +++ b/Modern Development/Service Portal Widgets/Open in Platform/server.js @@ -1,11 +1,16 @@ (function() { - data.table = input.table || $sp.getParameter("table"); - data.sys_id = input.sys_id || $sp.getParameter("sys_id"); - - data.url = "/nav_to.do?uri="+data.table+".do?sys_id="+data.sys_id; - - data.role = false; - if (gs.hasRole("itil")){ - data.role = true; - } + /* + Code will get table and sys_id parameter from url and create url for platform and sow. + 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.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. + data.role = true; + } })();