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/6] 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 3f59723e5e18710e9a01d9ccae0ab6a774dcf4e2 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:34:30 +0530 Subject: [PATCH 2/6] Create script.js --- .../validate Interaction record/script.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Client Scripts/validate Interaction record/script.js diff --git a/Client Scripts/validate Interaction record/script.js b/Client Scripts/validate Interaction record/script.js new file mode 100644 index 0000000000..de6511a9a6 --- /dev/null +++ b/Client Scripts/validate Interaction record/script.js @@ -0,0 +1,24 @@ + +//Client Script to validate an Interaction record is resolved with out any related record created. +function onSubmit() { + var relatedTask = g_form.getValue('u_boolean_no_related_task'); + var state = g_form.getValue('state'); + var type = g_form.getValue('type'); + var workNotes = g_form.getValue('work_notes'); // Get the value of work notes + + // Clear previous field messages + g_form.clearMessages(); + + // Check if state is changing to 'Closed Complete' + if (state == 'closed_complete') { + // Check additional conditions + if (type == 'walkup' && relatedTask == 'true') { + return true; // Allow form submission + } else if (!workNotes) { // Check if work notes is empty + g_form.showFieldMsg('work_notes', 'Provide Worknotes for FCR Interaction', 'error'); + alert('Provide Worknotes for FCR Interaction'); + return false; // Prevent form submission + } + } + return true; // Allow form submission for other states +} From 4de6213e7e2953440f77baf1acde15346b896d1a Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Tue, 28 Oct 2025 10:36:25 +0530 Subject: [PATCH 3/6] Create readme.md --- .../validate Interaction record/readme.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Client Scripts/validate Interaction record/readme.md diff --git a/Client Scripts/validate Interaction record/readme.md b/Client Scripts/validate Interaction record/readme.md new file mode 100644 index 0000000000..475d3a5154 --- /dev/null +++ b/Client Scripts/validate Interaction record/readme.md @@ -0,0 +1,78 @@ +README — Client Script: Validate Interaction Resolution +📌 Purpose +This Client Script ensures proper validation when resolving an Interaction record in ServiceNow. +It prevents a user from marking an Interaction as Closed Complete without proper justification. + +🎯 What It Does + +When a user attempts to submit the form: + +✔ Allows submission only if: + +Interaction Type is "walkup" + +And Related Task Boolean is true + +OR + +✔ If work notes are provided for First Contact Resolution (FCR) + +❌ Prevents submission if: + +State = Closed Complete + +Work Notes are empty + +And no related task condition is met + +🧠 Validations Performed +Field Condition Action +state closed_complete Trigger validation +type walkup AND u_boolean_no_related_task = true Submission allowed ✅ +work_notes Must not be empty Show error & stop submission ❌ +🔔 User Feedback + +If work notes are missing: + +Displays inline field message + +Shows popup alert: +"Provide Worknotes for FCR Interaction" + +📍 Script Location + +Client Script → Type: onSubmit() +Applicable to Interaction table (interaction) + +📌 Script Code +//Client Script to validate an Interaction record is resolved with out any related record created. +function onSubmit() { + var relatedTask = g_form.getValue('u_boolean_no_related_task'); + var state = g_form.getValue('state'); + var type = g_form.getValue('type'); + var workNotes = g_form.getValue('work_notes'); // Get the value of work notes + + // Clear previous field messages + g_form.clearMessages(); + + // Check if state is changing to 'Closed Complete' + if (state == 'closed_complete') { + // Check additional conditions + if (type == 'walkup' && relatedTask == 'true') { + return true; // Allow form submission + } else if (!workNotes) { // Check if work notes is empty + g_form.showFieldMsg('work_notes', 'Provide Worknotes for FCR Interaction', 'error'); + alert('Provide Worknotes for FCR Interaction'); + return false; // Prevent form submission + } + } + return true; // Allow form submission for other states +} + +✅ Benefits + +Maintains consistent resolution standards + +Ensures justification/documentation for FCR interactions + +Reduces incorrect closure of requests without related actions From 2903979ca87be6a508e1cf7e73fb0a8f75581ed4 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:21:48 +0530 Subject: [PATCH 4/6] Delete Client Scripts/validate Interaction record/readme.md --- .../validate Interaction record/readme.md | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 Client Scripts/validate Interaction record/readme.md diff --git a/Client Scripts/validate Interaction record/readme.md b/Client Scripts/validate Interaction record/readme.md deleted file mode 100644 index 475d3a5154..0000000000 --- a/Client Scripts/validate Interaction record/readme.md +++ /dev/null @@ -1,78 +0,0 @@ -README — Client Script: Validate Interaction Resolution -📌 Purpose -This Client Script ensures proper validation when resolving an Interaction record in ServiceNow. -It prevents a user from marking an Interaction as Closed Complete without proper justification. - -🎯 What It Does - -When a user attempts to submit the form: - -✔ Allows submission only if: - -Interaction Type is "walkup" - -And Related Task Boolean is true - -OR - -✔ If work notes are provided for First Contact Resolution (FCR) - -❌ Prevents submission if: - -State = Closed Complete - -Work Notes are empty - -And no related task condition is met - -🧠 Validations Performed -Field Condition Action -state closed_complete Trigger validation -type walkup AND u_boolean_no_related_task = true Submission allowed ✅ -work_notes Must not be empty Show error & stop submission ❌ -🔔 User Feedback - -If work notes are missing: - -Displays inline field message - -Shows popup alert: -"Provide Worknotes for FCR Interaction" - -📍 Script Location - -Client Script → Type: onSubmit() -Applicable to Interaction table (interaction) - -📌 Script Code -//Client Script to validate an Interaction record is resolved with out any related record created. -function onSubmit() { - var relatedTask = g_form.getValue('u_boolean_no_related_task'); - var state = g_form.getValue('state'); - var type = g_form.getValue('type'); - var workNotes = g_form.getValue('work_notes'); // Get the value of work notes - - // Clear previous field messages - g_form.clearMessages(); - - // Check if state is changing to 'Closed Complete' - if (state == 'closed_complete') { - // Check additional conditions - if (type == 'walkup' && relatedTask == 'true') { - return true; // Allow form submission - } else if (!workNotes) { // Check if work notes is empty - g_form.showFieldMsg('work_notes', 'Provide Worknotes for FCR Interaction', 'error'); - alert('Provide Worknotes for FCR Interaction'); - return false; // Prevent form submission - } - } - return true; // Allow form submission for other states -} - -✅ Benefits - -Maintains consistent resolution standards - -Ensures justification/documentation for FCR interactions - -Reduces incorrect closure of requests without related actions From 08744d3efcbd0341f1113930e193e1f7551e5801 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:22:31 +0530 Subject: [PATCH 5/6] 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 598bfd95d6057ef0096cd917093f355297afa645 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Tue, 28 Oct 2025 18:16:27 +0530 Subject: [PATCH 6/6] Create readme.md --- .../validate Interaction record/readme.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Client Scripts/validate Interaction record/readme.md diff --git a/Client Scripts/validate Interaction record/readme.md b/Client Scripts/validate Interaction record/readme.md new file mode 100644 index 0000000000..475d3a5154 --- /dev/null +++ b/Client Scripts/validate Interaction record/readme.md @@ -0,0 +1,78 @@ +README — Client Script: Validate Interaction Resolution +📌 Purpose +This Client Script ensures proper validation when resolving an Interaction record in ServiceNow. +It prevents a user from marking an Interaction as Closed Complete without proper justification. + +🎯 What It Does + +When a user attempts to submit the form: + +✔ Allows submission only if: + +Interaction Type is "walkup" + +And Related Task Boolean is true + +OR + +✔ If work notes are provided for First Contact Resolution (FCR) + +❌ Prevents submission if: + +State = Closed Complete + +Work Notes are empty + +And no related task condition is met + +🧠 Validations Performed +Field Condition Action +state closed_complete Trigger validation +type walkup AND u_boolean_no_related_task = true Submission allowed ✅ +work_notes Must not be empty Show error & stop submission ❌ +🔔 User Feedback + +If work notes are missing: + +Displays inline field message + +Shows popup alert: +"Provide Worknotes for FCR Interaction" + +📍 Script Location + +Client Script → Type: onSubmit() +Applicable to Interaction table (interaction) + +📌 Script Code +//Client Script to validate an Interaction record is resolved with out any related record created. +function onSubmit() { + var relatedTask = g_form.getValue('u_boolean_no_related_task'); + var state = g_form.getValue('state'); + var type = g_form.getValue('type'); + var workNotes = g_form.getValue('work_notes'); // Get the value of work notes + + // Clear previous field messages + g_form.clearMessages(); + + // Check if state is changing to 'Closed Complete' + if (state == 'closed_complete') { + // Check additional conditions + if (type == 'walkup' && relatedTask == 'true') { + return true; // Allow form submission + } else if (!workNotes) { // Check if work notes is empty + g_form.showFieldMsg('work_notes', 'Provide Worknotes for FCR Interaction', 'error'); + alert('Provide Worknotes for FCR Interaction'); + return false; // Prevent form submission + } + } + return true; // Allow form submission for other states +} + +✅ Benefits + +Maintains consistent resolution standards + +Ensures justification/documentation for FCR interactions + +Reduces incorrect closure of requests without related actions