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 01/19] 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 02/19] 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 03/19] 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 04/19] 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 05/19] 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 06/19] 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 2b9f82a04246e31ffea25b37e95578c8414cceee Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:01:11 +0530 Subject: [PATCH 07/19] Create script.js --- .../script.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js diff --git a/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js b/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js new file mode 100644 index 0000000000..0ac4b4dda8 --- /dev/null +++ b/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js @@ -0,0 +1,66 @@ +//Auto-assignment based on application variable selection in catalog +///* +//============================================================================== +// Script: Auto Assignment by Application Group +// Table: sc_req_item | When: Before Insert/Update + +// PREREQUISITES βœ… +// ------------------------------------------------------------------------------ +// 1️⃣ Catalog Variable must exist: +// - Name: dummy_app_group (Select Box) +// - Values: AppGroup A/B/C etc. + +// 2️⃣ Assignment Group sys_ids mapping must be updated with real values in PROD. + +// 3️⃣ Variable stored in sc_item_option_mtom for sync: + // - Name: dummy_group_variable (Reference: sys_user_group) + +// 4️⃣ Assignment Group field must be present on RITM form. + +// Summary: Auto-assign Assignment Group based on selected Application Group + + //update associated variable for data consistency. +//============================================================================== +//*/ + +(function executeRule(current, previous /*null when async*/) { + // Retrieve the application group variable + var appGroupVar = current.variables.dummy_app_group; + var groupSysId = ''; // This will store the dummy sys_id + + // Ensure the variable exists before proceeding + if (appGroupVar) { + var appGroupValue = appGroupVar.getDisplayValue(); // Get the display value of the variable + + // Match group values and assign dummy group sys_ids + if (appGroupValue === 'AppGroup A') { + groupSysId = '11111111111111111111111111111111'; + } else if (appGroupValue === 'AppGroup B') { + groupSysId = '22222222222222222222222222222222'; + } else if (appGroupValue === 'AppGroup C') { + groupSysId = '33333333333333333333333333333333'; + } + + // Update Assignment Group in the RITM + if (groupSysId) { + current.assignment_group = groupSysId; // Set dummy sys_id in Assignment Group + gs.addInfoMessage('Assignment Group updated to sys_id: ' + groupSysId); + + // Update the group variable on sc_item_option_mtom table + var grVars = new GlideRecord('sc_item_option_mtom'); + grVars.addQuery('request_item', current.sys_id); + grVars.addQuery('sc_item_option.item_option_new.name', 'dummy_group_variable'); + grVars.query(); + if (grVars.next()) { + grVars.value = groupSysId; + grVars.update(); + gs.addInfoMessage('Group variable updated to sys_id: ' + groupSysId); + } else { + gs.addErrorMessage('Group variable not found for the RITM.'); + } + } else { + gs.addErrorMessage('No valid Assignment Group found for: ' + appGroupValue); + } + } else { + gs.addErrorMessage('Application group variable is not set.'); + } +})(current, previous); From 3636380dba5ca12eac09047ad8823643987e4be7 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:04:05 +0530 Subject: [PATCH 08/19] Create readme.md --- .../readme.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md diff --git a/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md b/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md new file mode 100644 index 0000000000..2dfa32a15c --- /dev/null +++ b/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md @@ -0,0 +1,62 @@ +πŸ“˜ README β€” Auto Assignment by Application Group Variable +ServiceNow Business Rule β€” sc_req_item +βœ… Purpose + +This Business Rule automatically sets the Assignment Group on a Requested Item (RITM) based on the user’s selection in a catalog variable. It also updates the mapped variable value in the sc_item_option_mtom table to ensure data consistency across catalog records. + +πŸ”§ Where This Script Runs +Item Details +Table sc_req_item +When Before Insert / Before Update +Script Type Business Rule +Execution Scope Server-side +πŸ“Œ Prerequisites + +For this script to operate correctly: + +1️⃣ Catalog Variable exists on the item: + +Name β†’ dummy_app_group + +Type β†’ Select Box + +Possible Values β†’ AppGroup A, AppGroup B, AppGroup C, etc. + +2️⃣ Assignment Group sys_ids should be updated to real sys_ids in Production. + +3️⃣ The variable that stores reference to the group must be mapped in M2M table: + +Name β†’ dummy_group_variable + +Type β†’ Reference (sys_user_group) + +4️⃣ Assignment Group field must be visible and editable on RITM. + +πŸš€ What the Script Does + +βœ” Reads catalog variable value selected by requester +βœ” Matches the value and determines corresponding Assignment Group +βœ” Updates RITM field assignment_group +βœ” Updates dummy_group_variable in sc_item_option_mtom table +βœ” Displays info/error messages for debugging and validation + +🧩 Example Mapping Used in This Script +Catalog Variable Value Assignment Group (Dummy sys_id) +AppGroup A 11111111111111111111111111111111 +AppGroup B 22222222222222222222222222222222 +AppGroup C 33333333333333333333333333333333 + +Replace with actual assignment group sys_ids before deployment. + +βœ… Benefits +Feature Advantage +Automated Group Assignment Eliminates manual errors & delays +Consistency in Catalog Variables Accurate reporting and auditing +Debug-Friendly Messaging Quick validation during testing +πŸ› οΈ Deployment Notes + +Disable info messages (gs.addInfoMessage) after successful testing + +Maintain updates when catalog variable choices expand + +Avoid hard-coding by considering future enhancement β†’ mapping object / system properties From ac43b5871816251c4b4866a225b71c9961ec3197 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:07:24 +0530 Subject: [PATCH 09/19] 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 45338705feb63323782a18e739aa238775ba24f5 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:07:43 +0530 Subject: [PATCH 10/19] Delete Client Scripts/validate Interaction record/script.js --- .../validate Interaction record/script.js | 24 ------------------- 1 file changed, 24 deletions(-) delete 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 deleted file mode 100644 index de6511a9a6..0000000000 --- a/Client Scripts/validate Interaction record/script.js +++ /dev/null @@ -1,24 +0,0 @@ - -//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 a5b97fc14cc72ae1336ff262c6e7414633a3b129 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:48:46 +0530 Subject: [PATCH 11/19] Create script.js --- .../script.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js diff --git a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js new file mode 100644 index 0000000000..307f00a1d9 --- /dev/null +++ b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js @@ -0,0 +1,29 @@ +// Business Rule: Set Resolution SLA on Related Tasks +// Table: task_sla +// When: After Insert + +// PURPOSE: +// When a new Task SLA is created for Resolution SLA, update the related records. + +// CONDITIONS: +// SLA Definition target = "Resolution" +// Run only if task is Incident or SC Task +// (current.task.sys_class_name == 'incident' || current.task.sys_class_name == 'sc_task') + +// STEP 1: +// Get the related Incident record from current.task reference +var inc = new GlideRecord('incident'); // Query Incident table +inc.get(current.task); // Fetch the matching incident record + +// Update Incident’s custom field to store the Resolution SLA reference +inc.u_resolution_sla = current.sys_id; // Set current task_sla sys_id +inc.update(); // Save changes to Incident + +// STEP 2: +// Get the related Task record from current.task reference +var tsk = new GlideRecord('task'); // Query Task table +tsk.get(current.task); // Fetch the task (incident/sc_task/etc.) + +// Update Task’s custom field to store the Resolution SLA reference +tsk.u_task_resolution_sla = current.sys_id; // Set current task_sla sys_id +tsk.update(); // Save changes to Task From 00436aa2f9d15d3b892fe668cd2ad33572e98610 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:56:10 +0530 Subject: [PATCH 12/19] Create readme.md --- .../readme.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md diff --git a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md new file mode 100644 index 0000000000..a66f646ec5 --- /dev/null +++ b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md @@ -0,0 +1,67 @@ +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 5a0e77c041a4f300ebda106862b63533fc1551e9 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:56:43 +0530 Subject: [PATCH 13/19] Update script.js --- .../script.js | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js index 307f00a1d9..1b43c255d2 100644 --- a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js +++ b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js @@ -1,29 +1,23 @@ -// Business Rule: Set Resolution SLA on Related Tasks -// Table: task_sla -// When: After Insert +//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 -// PURPOSE: -// When a new Task SLA is created for Resolution SLA, update the related records. + // Clear previous field messages + g_form.clearMessages(); -// CONDITIONS: -// SLA Definition target = "Resolution" -// Run only if task is Incident or SC Task -// (current.task.sys_class_name == 'incident' || current.task.sys_class_name == 'sc_task') - -// STEP 1: -// Get the related Incident record from current.task reference -var inc = new GlideRecord('incident'); // Query Incident table -inc.get(current.task); // Fetch the matching incident record - -// Update Incident’s custom field to store the Resolution SLA reference -inc.u_resolution_sla = current.sys_id; // Set current task_sla sys_id -inc.update(); // Save changes to Incident - -// STEP 2: -// Get the related Task record from current.task reference -var tsk = new GlideRecord('task'); // Query Task table -tsk.get(current.task); // Fetch the task (incident/sc_task/etc.) - -// Update Task’s custom field to store the Resolution SLA reference -tsk.u_task_resolution_sla = current.sys_id; // Set current task_sla sys_id -tsk.update(); // Save changes to Task + // 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 8e52c440b7b132d8e3362f71aa14047ff578fb4e Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:00:27 +0530 Subject: [PATCH 14/19] Create script.js --- .../script.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/script.js diff --git a/Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/script.js b/Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/script.js new file mode 100644 index 0000000000..1b43c255d2 --- /dev/null +++ b/Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/script.js @@ -0,0 +1,23 @@ +//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 4ded45c6e403c30421f208e5a1c62e171f8c03b2 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:01:25 +0530 Subject: [PATCH 15/19] Create readme.md --- .../readme.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/readme.md diff --git a/Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/readme.md b/Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/readme.md new file mode 100644 index 0000000000..b56913d420 --- /dev/null +++ b/Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)/readme.md @@ -0,0 +1,71 @@ +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 e068b3ad91c8915340d5f224610c543cf4dad675 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:03:15 +0530 Subject: [PATCH 16/19] Delete Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md --- .../readme.md | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md diff --git a/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md b/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md deleted file mode 100644 index 2dfa32a15c..0000000000 --- a/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md +++ /dev/null @@ -1,62 +0,0 @@ -πŸ“˜ README β€” Auto Assignment by Application Group Variable -ServiceNow Business Rule β€” sc_req_item -βœ… Purpose - -This Business Rule automatically sets the Assignment Group on a Requested Item (RITM) based on the user’s selection in a catalog variable. It also updates the mapped variable value in the sc_item_option_mtom table to ensure data consistency across catalog records. - -πŸ”§ Where This Script Runs -Item Details -Table sc_req_item -When Before Insert / Before Update -Script Type Business Rule -Execution Scope Server-side -πŸ“Œ Prerequisites - -For this script to operate correctly: - -1️⃣ Catalog Variable exists on the item: - -Name β†’ dummy_app_group - -Type β†’ Select Box - -Possible Values β†’ AppGroup A, AppGroup B, AppGroup C, etc. - -2️⃣ Assignment Group sys_ids should be updated to real sys_ids in Production. - -3️⃣ The variable that stores reference to the group must be mapped in M2M table: - -Name β†’ dummy_group_variable - -Type β†’ Reference (sys_user_group) - -4️⃣ Assignment Group field must be visible and editable on RITM. - -πŸš€ What the Script Does - -βœ” Reads catalog variable value selected by requester -βœ” Matches the value and determines corresponding Assignment Group -βœ” Updates RITM field assignment_group -βœ” Updates dummy_group_variable in sc_item_option_mtom table -βœ” Displays info/error messages for debugging and validation - -🧩 Example Mapping Used in This Script -Catalog Variable Value Assignment Group (Dummy sys_id) -AppGroup A 11111111111111111111111111111111 -AppGroup B 22222222222222222222222222222222 -AppGroup C 33333333333333333333333333333333 - -Replace with actual assignment group sys_ids before deployment. - -βœ… Benefits -Feature Advantage -Automated Group Assignment Eliminates manual errors & delays -Consistency in Catalog Variables Accurate reporting and auditing -Debug-Friendly Messaging Quick validation during testing -πŸ› οΈ Deployment Notes - -Disable info messages (gs.addInfoMessage) after successful testing - -Maintain updates when catalog variable choices expand - -Avoid hard-coding by considering future enhancement β†’ mapping object / system properties From 88818d776131d6817987598da20a6155eee0c93a Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:03:37 +0530 Subject: [PATCH 17/19] Delete Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js --- .../script.js | 66 ------------------- 1 file changed, 66 deletions(-) delete mode 100644 Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js diff --git a/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js b/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js deleted file mode 100644 index 0ac4b4dda8..0000000000 --- a/Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js +++ /dev/null @@ -1,66 +0,0 @@ -//Auto-assignment based on application variable selection in catalog -///* -//============================================================================== -// Script: Auto Assignment by Application Group -// Table: sc_req_item | When: Before Insert/Update - -// PREREQUISITES βœ… -// ------------------------------------------------------------------------------ -// 1️⃣ Catalog Variable must exist: -// - Name: dummy_app_group (Select Box) -// - Values: AppGroup A/B/C etc. - -// 2️⃣ Assignment Group sys_ids mapping must be updated with real values in PROD. - -// 3️⃣ Variable stored in sc_item_option_mtom for sync: - // - Name: dummy_group_variable (Reference: sys_user_group) - -// 4️⃣ Assignment Group field must be present on RITM form. - -// Summary: Auto-assign Assignment Group based on selected Application Group + - //update associated variable for data consistency. -//============================================================================== -//*/ - -(function executeRule(current, previous /*null when async*/) { - // Retrieve the application group variable - var appGroupVar = current.variables.dummy_app_group; - var groupSysId = ''; // This will store the dummy sys_id - - // Ensure the variable exists before proceeding - if (appGroupVar) { - var appGroupValue = appGroupVar.getDisplayValue(); // Get the display value of the variable - - // Match group values and assign dummy group sys_ids - if (appGroupValue === 'AppGroup A') { - groupSysId = '11111111111111111111111111111111'; - } else if (appGroupValue === 'AppGroup B') { - groupSysId = '22222222222222222222222222222222'; - } else if (appGroupValue === 'AppGroup C') { - groupSysId = '33333333333333333333333333333333'; - } - - // Update Assignment Group in the RITM - if (groupSysId) { - current.assignment_group = groupSysId; // Set dummy sys_id in Assignment Group - gs.addInfoMessage('Assignment Group updated to sys_id: ' + groupSysId); - - // Update the group variable on sc_item_option_mtom table - var grVars = new GlideRecord('sc_item_option_mtom'); - grVars.addQuery('request_item', current.sys_id); - grVars.addQuery('sc_item_option.item_option_new.name', 'dummy_group_variable'); - grVars.query(); - if (grVars.next()) { - grVars.value = groupSysId; - grVars.update(); - gs.addInfoMessage('Group variable updated to sys_id: ' + groupSysId); - } else { - gs.addErrorMessage('Group variable not found for the RITM.'); - } - } else { - gs.addErrorMessage('No valid Assignment Group found for: ' + appGroupValue); - } - } else { - gs.addErrorMessage('Application group variable is not set.'); - } -})(current, previous); From 9b053c45258afb351240e9daec8dee8554981ac0 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:04:14 +0530 Subject: [PATCH 18/19] Delete Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md --- .../readme.md | 67 ------------------- 1 file changed, 67 deletions(-) delete mode 100644 Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md diff --git a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md deleted file mode 100644 index a66f646ec5..0000000000 --- a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md +++ /dev/null @@ -1,67 +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 d3020d87c4e851bcec757f208c6723515f82daa1 Mon Sep 17 00:00:00 2001 From: ReddySurendra <130588276+Suri123789@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:04:26 +0530 Subject: [PATCH 19/19] Delete Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js --- .../script.js | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js diff --git a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js b/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js deleted file mode 100644 index 1b43c255d2..0000000000 --- a/Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js +++ /dev/null @@ -1,23 +0,0 @@ -//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 -}