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; diff --git a/Specialized Areas/Notifications/Email Notification for KB Article Author with KB link/readme.md b/Specialized Areas/Notifications/Email Notification for KB Article Author with KB link/readme.md new file mode 100644 index 0000000000..7c883dd83f --- /dev/null +++ b/Specialized Areas/Notifications/Email Notification for KB Article Author with KB link/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) + +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 diff --git a/Specialized Areas/Notifications/Email Notification for KB Article Author with KB link/script.js b/Specialized Areas/Notifications/Email Notification for KB Article Author with KB link/script.js new file mode 100644 index 0000000000..11d81619d6 --- /dev/null +++ b/Specialized Areas/Notifications/Email Notification for KB Article Author with KB link/script.js @@ -0,0 +1,14 @@ +// 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);