From 21b615f12031c3d78653b5c67b681cf9a69c3799 Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Tue, 27 May 2025 12:30:58 +0530
Subject: [PATCH 1/4] Code for Moveworks bot messages for Flow to include url
links
---
Moveworks messages html for Flow | 38 ++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 Moveworks messages html for Flow
diff --git a/Moveworks messages html for Flow b/Moveworks messages html for Flow
new file mode 100644
index 0000000000..c228104146
--- /dev/null
+++ b/Moveworks messages html for Flow
@@ -0,0 +1,38 @@
+var article = fd_data._1__look_up_record.record;
+
+// Safely retrieve fields with null checks for a KB Article
+var sys_id = article.sys_id || '';
+var articleTitle = article.short_description || 'N/A';
+var requestedBy = fd_data.trigger.current.sys_created_by;
+var articleNumber = article.number || 'N/A';
+var requestedOn = article.sys_created_on || 'N/A';
+var kbName = (article.kb_knowledge_base && article.kb_knowledge_base.title) || 'N/A';
+var knowledgeManagers = (article.kb_knowledge_base && article.kb_knowledge_base.owner && article.kb_knowledge_base.owner.getDisplayValue()) || 'N/A';
+
+// Base URL
+var baseUrl = gs.getProperty('glide.servlet.uri') || '';
+var kbLink = baseUrl + 'kb_knowledge.do?sys_id=' + sys_id;
+//Below are links for opening the record in servicenow
+var approveLink = baseUrl + 'sysapproval_approver.do?action=approve&sys_id=' + sys_id;
+var rejectLink = baseUrl + 'sysapproval_approver.do?action=reject&sys_id=' + sys_id;
+//Below lines are for email template which is used to create email inbound template.
+var inst ='inspirebrandsdev';
+var approveSub = 'RE: '+ articleNumber +' Approve KB Article ';
+var body = 'Please do not change the subject, just click send message.';
+var rejectSub = 'RE: '+ articleNumber +' Reject KB Article ';
+
+
+// HTML message
+var message =
+ 'Pending approval request from ServiceNow
' +
+ '' + articleNumber + ': ' + articleTitle + '
' +
+ 'Requested by: ' + requestedBy + '
' +
+ 'Requested on: ' + requestedOn + '
' +
+ 'Knowledge Base: ' + kbName + '
' +
+ 'Knowledge Managers: ' + knowledgeManagers + '
' +
+ 'Approve link : Click here
'+
+ 'Reject link : Click here
';
+ //'Approve link : Click here to approve
' +
+ //'Reject link: Click here to reject';
+
+return message;
From 701d8db340df55dd556ec8c99ac63d20fad65fa5 Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Thu, 30 Oct 2025 11:34:21 +0530
Subject: [PATCH 2/4] Delete Moveworks messages html for Flow
---
Moveworks messages html for Flow | 38 --------------------------------
1 file changed, 38 deletions(-)
delete mode 100644 Moveworks messages html for Flow
diff --git a/Moveworks messages html for Flow b/Moveworks messages html for Flow
deleted file mode 100644
index c228104146..0000000000
--- a/Moveworks messages html for Flow
+++ /dev/null
@@ -1,38 +0,0 @@
-var article = fd_data._1__look_up_record.record;
-
-// Safely retrieve fields with null checks for a KB Article
-var sys_id = article.sys_id || '';
-var articleTitle = article.short_description || 'N/A';
-var requestedBy = fd_data.trigger.current.sys_created_by;
-var articleNumber = article.number || 'N/A';
-var requestedOn = article.sys_created_on || 'N/A';
-var kbName = (article.kb_knowledge_base && article.kb_knowledge_base.title) || 'N/A';
-var knowledgeManagers = (article.kb_knowledge_base && article.kb_knowledge_base.owner && article.kb_knowledge_base.owner.getDisplayValue()) || 'N/A';
-
-// Base URL
-var baseUrl = gs.getProperty('glide.servlet.uri') || '';
-var kbLink = baseUrl + 'kb_knowledge.do?sys_id=' + sys_id;
-//Below are links for opening the record in servicenow
-var approveLink = baseUrl + 'sysapproval_approver.do?action=approve&sys_id=' + sys_id;
-var rejectLink = baseUrl + 'sysapproval_approver.do?action=reject&sys_id=' + sys_id;
-//Below lines are for email template which is used to create email inbound template.
-var inst ='inspirebrandsdev';
-var approveSub = 'RE: '+ articleNumber +' Approve KB Article ';
-var body = 'Please do not change the subject, just click send message.';
-var rejectSub = 'RE: '+ articleNumber +' Reject KB Article ';
-
-
-// HTML message
-var message =
- 'Pending approval request from ServiceNow
' +
- '' + articleNumber + ': ' + articleTitle + '
' +
- 'Requested by: ' + requestedBy + '
' +
- 'Requested on: ' + requestedOn + '
' +
- 'Knowledge Base: ' + kbName + '
' +
- 'Knowledge Managers: ' + knowledgeManagers + '
' +
- 'Approve link : Click here
'+
- 'Reject link : Click here
';
- //'Approve link : Click here to approve
' +
- //'Reject link: Click here to reject';
-
-return message;
From 5e106954cc4a13780ce2f949ed287955ce4a3eeb Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 06:31:36 +0530
Subject: [PATCH 3/4] Create script.js
---
.../script.js | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/script.js
diff --git a/Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/script.js b/Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/script.js
new file mode 100644
index 0000000000..f62ccc3483
--- /dev/null
+++ b/Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/script.js
@@ -0,0 +1,15 @@
+//Add KB Article Link Dynamic Email Script to Notification
+// This script assumes it is used in a notification triggered by the kb_knowledge table.
+//use this line to get KB Number ${mail_script:get_kbarticle_link}
+//NOTE THE NAME OF THIS SCRIPT IS "get_kbarticle_link"IN EMAIL SCRIPTS TABLE _ "sys_script_email"
+
+
+(function executeEmailScript(current, template) {
+ // Construct the URL to the KB article
+
+ var instanceURL = gs.getProperty('glide.servlet.uri'); // Get the instance URL
+ var kbLink = instanceURL + "kb_view.do?sysparm_article=" + current.number; // Adjust based on your URL structure
+
+ // Output the link in HTML format
+ template.print('' + current.number + '');
+})(current, template);
From 7371a07196f4b5dc8fabe71bea363e392356ceda Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 06:32:15 +0530
Subject: [PATCH 4/4] Create readme.md
---
.../readme.md | 78 +++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/readme.md
diff --git a/Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/readme.md b/Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/readme.md
new file mode 100644
index 0000000000..29e7b2b332
--- /dev/null
+++ b/Specialized Areas/Notifications/Add KB Article Link Dynamic Email Script to Notification/readme.md
@@ -0,0 +1,78 @@
+📘 README — KB Article Link Email Script for Notification
+✅ Overview
+
+This script is used in a ServiceNow notification triggered from the kb_knowledge table.
+It dynamically retrieves the instance URL and constructs a clickable Knowledge Article link in the email body.
+
+🧩 Script Functionality
+✔ What It Does
+
+Builds a direct URL pointing to the KB article
+Displays the KB Number as a clickable hyperlink
+Opens the article in a new browser tab
+Improves Knowledge Manager review workflow
+
+🔧 Script Used
+// This script assumes it is used in a notification triggered by the kb_knowledge table.
+//use this line to get KB Number ${mail_script:get_kbarticle_link}
+(function executeEmailScript(current, template) {
+ // Construct the URL to the KB article
+
+ var instanceURL = gs.getProperty('glide.servlet.uri'); // Get the instance URL
+ var kbLink = instanceURL + "kb_view.do?sysparm_article=" + current.number; // Adjust based on your URL structure
+
+ // Output the link in HTML format
+ template.print('' + current.number + '');
+})(current, template);
+
+📝 Notification Configuration
+Setting Details
+Table Knowledge [kb_knowledge]
+Condition Example: State changes to Pending Approval
+Email Script Used ${mail_script:get_kbarticle_link}
+Audience Knowledge Managers / Approvers
+📥 Input
+Input Source Description
+current.number KB Article Number (e.g. KB0012345)
+System Property glide.servlet.uri — full instance URL
+Notification Payload Uses script reference in message body
+
+Example Input Values:
+
+Instance URL: https://company.service-now.com/
+KB Number: KB1029384
+
+⚙️ Process Flow
+
+1️⃣ Notification triggered on kb_knowledge
+2️⃣ Script collects instance URL
+3️⃣ Script forms hyperlink using KB Number
+4️⃣ Link injected into template via template.print
+5️⃣ Email delivered to recipients
+
+✅ Output / Result
+
+📌 Email will show a clickable KB Number link:
+➡ Example Link Generated:
+https://company.service-now.com/kb_view.do?sysparm_article=KB1029384
+
+
+📌 In Email (HTML):
+KB1029384 → Click → Opens article in new browser tab
+
+📬 Final Email Result Includes:
+KB Article Number (hyperlinked)
+Article details (added in notification body)
+Approve & Reject action buttons (if included)
+Cleaner and faster approval workflow
+
+🖼️ Visual Result (Explained from Shared Image)
+
+
+
+
+The screenshot you shared displays:
+✅ KB Article Number hyperlink
+✅ Metadata such as short description & requested by
+✅ Buttons for Article Approval / Rejection
+✅ HTML formatted clean layout for readability