From 31d7cdd0f9dd2a5526aca747329f78877aab1237 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 22 Oct 2025 20:02:59 +0530 Subject: [PATCH 01/12] Add script to display user mentions in Service Portal This script retrieves and displays the top 5 records where the logged-in user is mentioned, providing links to those records. --- .../My Mentioned Items/server.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Modern Development/Service Portal Widgets/My Mentioned Items/server.js diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/server.js b/Modern Development/Service Portal Widgets/My Mentioned Items/server.js new file mode 100644 index 0000000000..c7acf63dc1 --- /dev/null +++ b/Modern Development/Service Portal Widgets/My Mentioned Items/server.js @@ -0,0 +1,21 @@ +(function() { + /* + This code will get display the records wher user is mentioned. + This will also provide the link to record. + Only top 5 mentions will be displayed. + */ + data.mentionArr = []; // array to store mentions. + var mentionRec = new GlideRecord('live_notification'); + mentionRec.addEncodedQuery('user=' + gs.getUserID()); // get only logged-in user's records + mentionRec.orderBy('sys_created_on'); // get by created date. + mentionRec.setLimit(5); + mentionRec.query(); + while (mentionRec.next()) { + tempval = {}; // temp object. + tempval.record = mentionRec.getValue('title'); + tempval.user = mentionRec.user.name.toString(); + tempval.user_from = mentionRec.user_from.name.toString(); + tempval.url = '/' + $sp.getValue('url_suffix') + '?id=ticket&sys_id=' + mentionRec.getValue('document') + '&table=' + mentionRec.getValue('table'); + data.mentionArr.push(tempval); + } +})(); From c06f8741cbef5176d513c8080f60be3d67354a6f Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 22 Oct 2025 20:18:48 +0530 Subject: [PATCH 02/12] Delete Modern Development/Service Portal Widgets/My Mentioned Items directory --- .../My Mentioned Items/server.js | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 Modern Development/Service Portal Widgets/My Mentioned Items/server.js diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/server.js b/Modern Development/Service Portal Widgets/My Mentioned Items/server.js deleted file mode 100644 index c7acf63dc1..0000000000 --- a/Modern Development/Service Portal Widgets/My Mentioned Items/server.js +++ /dev/null @@ -1,21 +0,0 @@ -(function() { - /* - This code will get display the records wher user is mentioned. - This will also provide the link to record. - Only top 5 mentions will be displayed. - */ - data.mentionArr = []; // array to store mentions. - var mentionRec = new GlideRecord('live_notification'); - mentionRec.addEncodedQuery('user=' + gs.getUserID()); // get only logged-in user's records - mentionRec.orderBy('sys_created_on'); // get by created date. - mentionRec.setLimit(5); - mentionRec.query(); - while (mentionRec.next()) { - tempval = {}; // temp object. - tempval.record = mentionRec.getValue('title'); - tempval.user = mentionRec.user.name.toString(); - tempval.user_from = mentionRec.user_from.name.toString(); - tempval.url = '/' + $sp.getValue('url_suffix') + '?id=ticket&sys_id=' + mentionRec.getValue('document') + '&table=' + mentionRec.getValue('table'); - data.mentionArr.push(tempval); - } -})(); From 1e5fce571bccf37ba3b70002c29737f99afcff02 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 22 Oct 2025 20:22:42 +0530 Subject: [PATCH 03/12] Create script.js --- .../My Mentioned Items/script.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Modern Development/Service Portal Widgets/My Mentioned Items/script.js diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/script.js b/Modern Development/Service Portal Widgets/My Mentioned Items/script.js new file mode 100644 index 0000000000..c7acf63dc1 --- /dev/null +++ b/Modern Development/Service Portal Widgets/My Mentioned Items/script.js @@ -0,0 +1,21 @@ +(function() { + /* + This code will get display the records wher user is mentioned. + This will also provide the link to record. + Only top 5 mentions will be displayed. + */ + data.mentionArr = []; // array to store mentions. + var mentionRec = new GlideRecord('live_notification'); + mentionRec.addEncodedQuery('user=' + gs.getUserID()); // get only logged-in user's records + mentionRec.orderBy('sys_created_on'); // get by created date. + mentionRec.setLimit(5); + mentionRec.query(); + while (mentionRec.next()) { + tempval = {}; // temp object. + tempval.record = mentionRec.getValue('title'); + tempval.user = mentionRec.user.name.toString(); + tempval.user_from = mentionRec.user_from.name.toString(); + tempval.url = '/' + $sp.getValue('url_suffix') + '?id=ticket&sys_id=' + mentionRec.getValue('document') + '&table=' + mentionRec.getValue('table'); + data.mentionArr.push(tempval); + } +})(); From f368a8d2e60e996cf904d69ac8dabb6cbae9c622 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Wed, 22 Oct 2025 20:22:52 +0530 Subject: [PATCH 04/12] Delete Modern Development/Service Portal Widgets/My Mentioned Items directory --- .../My Mentioned Items/script.js | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 Modern Development/Service Portal Widgets/My Mentioned Items/script.js diff --git a/Modern Development/Service Portal Widgets/My Mentioned Items/script.js b/Modern Development/Service Portal Widgets/My Mentioned Items/script.js deleted file mode 100644 index c7acf63dc1..0000000000 --- a/Modern Development/Service Portal Widgets/My Mentioned Items/script.js +++ /dev/null @@ -1,21 +0,0 @@ -(function() { - /* - This code will get display the records wher user is mentioned. - This will also provide the link to record. - Only top 5 mentions will be displayed. - */ - data.mentionArr = []; // array to store mentions. - var mentionRec = new GlideRecord('live_notification'); - mentionRec.addEncodedQuery('user=' + gs.getUserID()); // get only logged-in user's records - mentionRec.orderBy('sys_created_on'); // get by created date. - mentionRec.setLimit(5); - mentionRec.query(); - while (mentionRec.next()) { - tempval = {}; // temp object. - tempval.record = mentionRec.getValue('title'); - tempval.user = mentionRec.user.name.toString(); - tempval.user_from = mentionRec.user_from.name.toString(); - tempval.url = '/' + $sp.getValue('url_suffix') + '?id=ticket&sys_id=' + mentionRec.getValue('document') + '&table=' + mentionRec.getValue('table'); - data.mentionArr.push(tempval); - } -})(); From df002e468c73339b41a6a708fb9e821a47f61dd6 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:22:16 +0530 Subject: [PATCH 05/12] Create script.js --- .../Retire Rating 1 Articles/script.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js diff --git a/Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js b/Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js new file mode 100644 index 0000000000..916255ec35 --- /dev/null +++ b/Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js @@ -0,0 +1,21 @@ +/* +This schedule job will run daily EOD PST time. +This Job will look for articles which have been rated 1 three times and will retire those articles. + +*/ +var kbFeed = new GlideAggregate('kb_feedback'); +kbFeed.addEncodedQuery('rating=1'); // get articles with rating 1. +kbFeed.addAggregate('COUNT', 'article'); +kbFeed.groupBy('user'); +kbFeed.query(); +while (kbFeed.next()) { + + if (kbFeed.getAggregate('COUNT', 'article') >= 3) { + var updateArt = new GlideRecord('kb_knowledge'); + updateArt.get(kbFeed.article.sys_id); + if (updateArt.workflow_state == 'published') { + updateArt.workflow_state = 'retired'; + updateArt.update(); + } + } +} From 31be0ba0034e507585f31663e8e81b905ea66577 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:22:30 +0530 Subject: [PATCH 06/12] Delete Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles directory --- .../Retire Rating 1 Articles/script.js | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js diff --git a/Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js b/Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js deleted file mode 100644 index 916255ec35..0000000000 --- a/Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles/script.js +++ /dev/null @@ -1,21 +0,0 @@ -/* -This schedule job will run daily EOD PST time. -This Job will look for articles which have been rated 1 three times and will retire those articles. - -*/ -var kbFeed = new GlideAggregate('kb_feedback'); -kbFeed.addEncodedQuery('rating=1'); // get articles with rating 1. -kbFeed.addAggregate('COUNT', 'article'); -kbFeed.groupBy('user'); -kbFeed.query(); -while (kbFeed.next()) { - - if (kbFeed.getAggregate('COUNT', 'article') >= 3) { - var updateArt = new GlideRecord('kb_knowledge'); - updateArt.get(kbFeed.article.sys_id); - if (updateArt.workflow_state == 'published') { - updateArt.workflow_state = 'retired'; - updateArt.update(); - } - } -} From 013f5ee40673f5a0d4b3ac0d9d91d6b48646fa6e Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 24 Oct 2025 18:08:51 +0530 Subject: [PATCH 07/12] Update body.html --- .../Service Portal Widgets/Open in Platform/body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@
{{::options.open_in_platform}}
- {{::options.open_in_sow}} + {{::options.open_in_workspace}}
From e789677745132101c1c72db118d5e854e8de6c87 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 24 Oct 2025 18:11:09 +0530 Subject: [PATCH 08/12] Update server.js --- .../Open in Platform/server.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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. From 0cdb6411eb8100cd12ed72df4fec8ecedbef7a1a Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 24 Oct 2025 18:11:49 +0530 Subject: [PATCH 09/12] Update option schema.js --- .../Open in Platform/option schema.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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..6aa2c202f3 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,17 @@ "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" +} } ] From 3fa46818cb3a3cfacef60735e2ff5789b9da4f9a Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 24 Oct 2025 18:16:14 +0530 Subject: [PATCH 10/12] Update README.md --- .../Service Portal Widgets/Open in Platform/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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..6ae4a732d0 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,7 @@ **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). -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. +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. From c661ece50acd57cb27705651b2f444f142dfd3b0 Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 24 Oct 2025 18:17:04 +0530 Subject: [PATCH 11/12] Update option schema.js --- .../Service Portal Widgets/Open in Platform/option schema.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 6aa2c202f3..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 @@ -16,7 +16,8 @@ "type":"json", "label":"Define Table Workspace JSON Mapping", "value":{ - "sn_grc_issue":"risk/privacy" + "sn_grc_issue":"risk/privacy", + "sn_si_incident":"sir" } } ] From 3b60800c12cd2713560c47dcb78bd3e12df42d5d Mon Sep 17 00:00:00 2001 From: Raghav Sharma <53517312+raghavs046@users.noreply.github.com> Date: Fri, 24 Oct 2025 18:18:12 +0530 Subject: [PATCH 12/12] Update README.md --- .../Open in Platform/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 6ae4a732d0..d80671260b 100644 --- a/Modern Development/Service Portal Widgets/Open in Platform/README.md +++ b/Modern Development/Service Portal Widgets/Open in Platform/README.md @@ -3,5 +3,17 @@ 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" + +**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.