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/8] 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/8] 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 71ce1e5b6533bcffcf4f39cfbfb1ff1d655c6d5b Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 09:03:24 +0530
Subject: [PATCH 3/8] Create script.js
---
.../script.js | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js
diff --git a/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js b/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js
new file mode 100644
index 0000000000..769f4c481e
--- /dev/null
+++ b/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js
@@ -0,0 +1,56 @@
+// ==========================================================================
+// Script Name: Auto Priority Update based on Impact and Urgency
+// Table: Incident (or any Task-based table)
+// Type: onChange | Fields: impact, urgency
+// UI Type: All
+// ==========================================================================
+
+function onChange(control, oldValue, newValue, isLoading, isTemplate) {
+ // Prevent the script from running when the form loads or when the field is empty
+ if (isLoading || newValue == '') {
+ return;
+ }
+
+ // ----------------------------------------------------------------------
+ // Step 1: Fetch field values from the form
+ // ----------------------------------------------------------------------
+ var impact = g_form.getValue('impact'); // e.g., 1 - High, 2 - Medium, 3 - Low
+ var urgency = g_form.getValue('urgency'); // e.g., 1 - High, 2 - Medium, 3 - Low
+
+ // ----------------------------------------------------------------------
+ // Step 2: Define the ITIL-based Priority Matrix
+ // ----------------------------------------------------------------------
+ // Each row represents "Impact", and each column represents "Urgency"
+ // The resulting value sets the "Priority"
+ var priorityMatrix = {
+ '1': { '1': '1', '2': '2', '3': '3' }, // Impact = High
+ '2': { '1': '2', '2': '3', '3': '4' }, // Impact = Medium
+ '3': { '1': '3', '2': '4', '3': '5' } // Impact = Low
+ };
+
+ // ----------------------------------------------------------------------
+ // Step 3: Determine the new priority based on selected Impact/Urgency
+ // ----------------------------------------------------------------------
+ var newPriority = priorityMatrix[impact]?.[urgency]; // optional chaining prevents errors
+
+ // ----------------------------------------------------------------------
+ // Step 4: Update the Priority field and inform the user
+ // ----------------------------------------------------------------------
+ if (newPriority) {
+ // Only update if priority is different from current value
+ if (g_form.getValue('priority') != newPriority) {
+ g_form.setValue('priority', newPriority);
+
+ // Show message (works in both Classic UI and Next Experience)
+ g_form.showFieldMsg('priority', 'Priority auto-updated based on Impact and Urgency', 'info');
+ }
+ } else {
+ // Optional: clear priority if invalid combination is selected
+ g_form.clearValue('priority');
+ g_form.showFieldMsg('priority', 'Invalid Impact/Urgency combination — priority cleared', 'error');
+ }
+
+ // ----------------------------------------------------------------------
+ // End of Script
+ // ----------------------------------------------------------------------
+}
From 5d925c3b8a2edffbedb1b5771ca01c7819eca635 Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 09:04:38 +0530
Subject: [PATCH 4/8] Create readme.md
---
.../readme.md | 81 +++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md
diff --git a/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md b/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md
new file mode 100644
index 0000000000..8d1628deb7
--- /dev/null
+++ b/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md
@@ -0,0 +1,81 @@
+🧩 Readme : Client Script: Auto Priority Update Based on Impact and Urgency
+📘 Overview
+
+This client script automatically updates the Priority field on the Incident form whenever the Impact or Urgency value changes.
+It follows the ITIL standard mapping to ensure the correct priority is always set automatically, improving data accuracy and efficiency for service desk agents.
+
+⚙️ Script Details
+Field Value
+Name Auto Priority Update based on Impact and Urgency
+Type onChange
+Applies to Table Incident
+Applies on Fields impact, urgency
+UI Type All (Classic, Mobile, Workspace)
+Active ✅ Yes
+Condition Leave blank
+💻 Script Code
+// ==========================================================================
+// Script Name: Auto Priority Update based on Impact and Urgency
+// Table: Incident
+// Type: onChange | Fields: impact, urgency
+// UI Type: All
+// Version: 2025 Production Ready
+// ==========================================================================
+
+function onChange(control, oldValue, newValue, isLoading, isTemplate) {
+ // Skip execution if form is loading or field is empty
+ if (isLoading || newValue == '') {
+ return;
+ }
+
+ // Get Impact and Urgency values
+ var impact = g_form.getValue('impact');
+ var urgency = g_form.getValue('urgency');
+
+ // Define Priority Matrix (ITIL standard)
+ var priorityMatrix = {
+ '1': { '1': '1', '2': '2', '3': '3' },
+ '2': { '1': '2', '2': '3', '3': '4' },
+ '3': { '1': '3', '2': '4', '3': '5' }
+ };
+
+ // Find the new Priority
+ var newPriority = priorityMatrix[impact]?.[urgency];
+
+ // Update the Priority field if valid
+ if (newPriority) {
+ if (g_form.getValue('priority') != newPriority) {
+ g_form.setValue('priority', newPriority);
+ g_form.showFieldMsg('priority', 'Priority auto-updated based on Impact and Urgency', 'info');
+ }
+ } else {
+ // Optional: Clear Priority if invalid combination is selected
+ g_form.clearValue('priority');
+ g_form.showFieldMsg('priority', 'Invalid Impact/Urgency combination — priority cleared', 'error');
+ }
+}
+
+🧠 How It Works
+
+The script runs automatically when Impact or Urgency changes.
+It checks the ITIL-based matrix to determine the correct Priority.
+If a valid combination is found, the Priority field updates automatically.
+A small info message appears to confirm the update.
+
+🔢 ITIL Mapping Table
+Impact Urgency Resulting Priority
+1 (High) 1 (High) 1 (Critical)
+1 2 2
+1 3 3
+2 1 2
+2 2 3
+2 3 4
+3 1 3
+3 2 4
+3 3 5
+✅ Benefits
+
+Automatically enforces ITIL priority standards
+Reduces manual effort and user errors
+Ensures consistency in priority calculation
+Compatible with Classic UI, Next Experience, and Agent Workspace
From 565439de831b88698ee1973d816f67a267e65c0b Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 09:11:10 +0530
Subject: [PATCH 5/8] Create script.js
---
.../script.js | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/script.js
diff --git a/Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/script.js b/Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/script.js
new file mode 100644
index 0000000000..b718b3185a
--- /dev/null
+++ b/Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/script.js
@@ -0,0 +1,58 @@
+//Auto Priority Update based on Impact and Urgency
+
+// ==========================================================================
+// Script Name: Auto Priority Update based on Impact and Urgency
+// Table: Incident (or any Task-based table)
+// Type: onChange | Fields: impact, urgency
+// UI Type: All
+// ==========================================================================
+
+function onChange(control, oldValue, newValue, isLoading, isTemplate) {
+ // Prevent the script from running when the form loads or when the field is empty
+ if (isLoading || newValue == '') {
+ return;
+ }
+
+ // ----------------------------------------------------------------------
+ // Step 1: Fetch field values from the form
+ // ----------------------------------------------------------------------
+ var impact = g_form.getValue('impact'); // e.g., 1 - High, 2 - Medium, 3 - Low
+ var urgency = g_form.getValue('urgency'); // e.g., 1 - High, 2 - Medium, 3 - Low
+
+ // ----------------------------------------------------------------------
+ // Step 2: Define the ITIL-based Priority Matrix
+ // ----------------------------------------------------------------------
+ // Each row represents "Impact", and each column represents "Urgency"
+ // The resulting value sets the "Priority"
+ var priorityMatrix = {
+ '1': { '1': '1', '2': '2', '3': '3' }, // Impact = High
+ '2': { '1': '2', '2': '3', '3': '4' }, // Impact = Medium
+ '3': { '1': '3', '2': '4', '3': '5' } // Impact = Low
+ };
+
+ // ----------------------------------------------------------------------
+ // Step 3: Determine the new priority based on selected Impact/Urgency
+ // ----------------------------------------------------------------------
+ var newPriority = priorityMatrix[impact]?.[urgency]; // optional chaining prevents errors
+
+ // ----------------------------------------------------------------------
+ // Step 4: Update the Priority field and inform the user
+ // ----------------------------------------------------------------------
+ if (newPriority) {
+ // Only update if priority is different from current value
+ if (g_form.getValue('priority') != newPriority) {
+ g_form.setValue('priority', newPriority);
+
+ // Show message (works in both Classic UI and Next Experience)
+ g_form.showFieldMsg('priority', 'Priority auto-updated based on Impact and Urgency', 'info');
+ }
+ } else {
+ // Optional: clear priority if invalid combination is selected
+ g_form.clearValue('priority');
+ g_form.showFieldMsg('priority', 'Invalid Impact/Urgency combination — priority cleared', 'error');
+ }
+
+ // ----------------------------------------------------------------------
+ // End of Script
+ // ----------------------------------------------------------------------
+}
From 64cec99d8084b7be0efc10de40a176c1dfe43529 Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 09:11:46 +0530
Subject: [PATCH 6/8] Create readme.md
---
.../readme.md | 81 +++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/readme.md
diff --git a/Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/readme.md b/Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/readme.md
new file mode 100644
index 0000000000..8d1628deb7
--- /dev/null
+++ b/Client-Side Components/Client Scripts/Auto Update Priority based on Impact and Urgency/readme.md
@@ -0,0 +1,81 @@
+🧩 Readme : Client Script: Auto Priority Update Based on Impact and Urgency
+📘 Overview
+
+This client script automatically updates the Priority field on the Incident form whenever the Impact or Urgency value changes.
+It follows the ITIL standard mapping to ensure the correct priority is always set automatically, improving data accuracy and efficiency for service desk agents.
+
+⚙️ Script Details
+Field Value
+Name Auto Priority Update based on Impact and Urgency
+Type onChange
+Applies to Table Incident
+Applies on Fields impact, urgency
+UI Type All (Classic, Mobile, Workspace)
+Active ✅ Yes
+Condition Leave blank
+💻 Script Code
+// ==========================================================================
+// Script Name: Auto Priority Update based on Impact and Urgency
+// Table: Incident
+// Type: onChange | Fields: impact, urgency
+// UI Type: All
+// Version: 2025 Production Ready
+// ==========================================================================
+
+function onChange(control, oldValue, newValue, isLoading, isTemplate) {
+ // Skip execution if form is loading or field is empty
+ if (isLoading || newValue == '') {
+ return;
+ }
+
+ // Get Impact and Urgency values
+ var impact = g_form.getValue('impact');
+ var urgency = g_form.getValue('urgency');
+
+ // Define Priority Matrix (ITIL standard)
+ var priorityMatrix = {
+ '1': { '1': '1', '2': '2', '3': '3' },
+ '2': { '1': '2', '2': '3', '3': '4' },
+ '3': { '1': '3', '2': '4', '3': '5' }
+ };
+
+ // Find the new Priority
+ var newPriority = priorityMatrix[impact]?.[urgency];
+
+ // Update the Priority field if valid
+ if (newPriority) {
+ if (g_form.getValue('priority') != newPriority) {
+ g_form.setValue('priority', newPriority);
+ g_form.showFieldMsg('priority', 'Priority auto-updated based on Impact and Urgency', 'info');
+ }
+ } else {
+ // Optional: Clear Priority if invalid combination is selected
+ g_form.clearValue('priority');
+ g_form.showFieldMsg('priority', 'Invalid Impact/Urgency combination — priority cleared', 'error');
+ }
+}
+
+🧠 How It Works
+
+The script runs automatically when Impact or Urgency changes.
+It checks the ITIL-based matrix to determine the correct Priority.
+If a valid combination is found, the Priority field updates automatically.
+A small info message appears to confirm the update.
+
+🔢 ITIL Mapping Table
+Impact Urgency Resulting Priority
+1 (High) 1 (High) 1 (Critical)
+1 2 2
+1 3 3
+2 1 2
+2 2 3
+2 3 4
+3 1 3
+3 2 4
+3 3 5
+✅ Benefits
+
+Automatically enforces ITIL priority standards
+Reduces manual effort and user errors
+Ensures consistency in priority calculation
+Compatible with Classic UI, Next Experience, and Agent Workspace
From 4801a3fc7b143ac6a9a630612ef0afdb2720f771 Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 09:13:59 +0530
Subject: [PATCH 7/8] Delete Client-Side Components/Client Scripts/Auto
Priority Update based on Impact and Urgency/readme.md
---
.../readme.md | 81 -------------------
1 file changed, 81 deletions(-)
delete mode 100644 Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md
diff --git a/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md b/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md
deleted file mode 100644
index 8d1628deb7..0000000000
--- a/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/readme.md
+++ /dev/null
@@ -1,81 +0,0 @@
-🧩 Readme : Client Script: Auto Priority Update Based on Impact and Urgency
-📘 Overview
-
-This client script automatically updates the Priority field on the Incident form whenever the Impact or Urgency value changes.
-It follows the ITIL standard mapping to ensure the correct priority is always set automatically, improving data accuracy and efficiency for service desk agents.
-
-⚙️ Script Details
-Field Value
-Name Auto Priority Update based on Impact and Urgency
-Type onChange
-Applies to Table Incident
-Applies on Fields impact, urgency
-UI Type All (Classic, Mobile, Workspace)
-Active ✅ Yes
-Condition Leave blank
-💻 Script Code
-// ==========================================================================
-// Script Name: Auto Priority Update based on Impact and Urgency
-// Table: Incident
-// Type: onChange | Fields: impact, urgency
-// UI Type: All
-// Version: 2025 Production Ready
-// ==========================================================================
-
-function onChange(control, oldValue, newValue, isLoading, isTemplate) {
- // Skip execution if form is loading or field is empty
- if (isLoading || newValue == '') {
- return;
- }
-
- // Get Impact and Urgency values
- var impact = g_form.getValue('impact');
- var urgency = g_form.getValue('urgency');
-
- // Define Priority Matrix (ITIL standard)
- var priorityMatrix = {
- '1': { '1': '1', '2': '2', '3': '3' },
- '2': { '1': '2', '2': '3', '3': '4' },
- '3': { '1': '3', '2': '4', '3': '5' }
- };
-
- // Find the new Priority
- var newPriority = priorityMatrix[impact]?.[urgency];
-
- // Update the Priority field if valid
- if (newPriority) {
- if (g_form.getValue('priority') != newPriority) {
- g_form.setValue('priority', newPriority);
- g_form.showFieldMsg('priority', 'Priority auto-updated based on Impact and Urgency', 'info');
- }
- } else {
- // Optional: Clear Priority if invalid combination is selected
- g_form.clearValue('priority');
- g_form.showFieldMsg('priority', 'Invalid Impact/Urgency combination — priority cleared', 'error');
- }
-}
-
-🧠 How It Works
-
-The script runs automatically when Impact or Urgency changes.
-It checks the ITIL-based matrix to determine the correct Priority.
-If a valid combination is found, the Priority field updates automatically.
-A small info message appears to confirm the update.
-
-🔢 ITIL Mapping Table
-Impact Urgency Resulting Priority
-1 (High) 1 (High) 1 (Critical)
-1 2 2
-1 3 3
-2 1 2
-2 2 3
-2 3 4
-3 1 3
-3 2 4
-3 3 5
-✅ Benefits
-
-Automatically enforces ITIL priority standards
-Reduces manual effort and user errors
-Ensures consistency in priority calculation
-Compatible with Classic UI, Next Experience, and Agent Workspace
From bbb2322da9810636bbd897689fef635e4a68fc78 Mon Sep 17 00:00:00 2001
From: ReddySurendra <130588276+Suri123789@users.noreply.github.com>
Date: Fri, 31 Oct 2025 09:14:15 +0530
Subject: [PATCH 8/8] Delete Client-Side Components/Client Scripts/Auto
Priority Update based on Impact and Urgency/script.js
---
.../script.js | 56 -------------------
1 file changed, 56 deletions(-)
delete mode 100644 Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js
diff --git a/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js b/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js
deleted file mode 100644
index 769f4c481e..0000000000
--- a/Client-Side Components/Client Scripts/Auto Priority Update based on Impact and Urgency/script.js
+++ /dev/null
@@ -1,56 +0,0 @@
-// ==========================================================================
-// Script Name: Auto Priority Update based on Impact and Urgency
-// Table: Incident (or any Task-based table)
-// Type: onChange | Fields: impact, urgency
-// UI Type: All
-// ==========================================================================
-
-function onChange(control, oldValue, newValue, isLoading, isTemplate) {
- // Prevent the script from running when the form loads or when the field is empty
- if (isLoading || newValue == '') {
- return;
- }
-
- // ----------------------------------------------------------------------
- // Step 1: Fetch field values from the form
- // ----------------------------------------------------------------------
- var impact = g_form.getValue('impact'); // e.g., 1 - High, 2 - Medium, 3 - Low
- var urgency = g_form.getValue('urgency'); // e.g., 1 - High, 2 - Medium, 3 - Low
-
- // ----------------------------------------------------------------------
- // Step 2: Define the ITIL-based Priority Matrix
- // ----------------------------------------------------------------------
- // Each row represents "Impact", and each column represents "Urgency"
- // The resulting value sets the "Priority"
- var priorityMatrix = {
- '1': { '1': '1', '2': '2', '3': '3' }, // Impact = High
- '2': { '1': '2', '2': '3', '3': '4' }, // Impact = Medium
- '3': { '1': '3', '2': '4', '3': '5' } // Impact = Low
- };
-
- // ----------------------------------------------------------------------
- // Step 3: Determine the new priority based on selected Impact/Urgency
- // ----------------------------------------------------------------------
- var newPriority = priorityMatrix[impact]?.[urgency]; // optional chaining prevents errors
-
- // ----------------------------------------------------------------------
- // Step 4: Update the Priority field and inform the user
- // ----------------------------------------------------------------------
- if (newPriority) {
- // Only update if priority is different from current value
- if (g_form.getValue('priority') != newPriority) {
- g_form.setValue('priority', newPriority);
-
- // Show message (works in both Classic UI and Next Experience)
- g_form.showFieldMsg('priority', 'Priority auto-updated based on Impact and Urgency', 'info');
- }
- } else {
- // Optional: clear priority if invalid combination is selected
- g_form.clearValue('priority');
- g_form.showFieldMsg('priority', 'Invalid Impact/Urgency combination — priority cleared', 'error');
- }
-
- // ----------------------------------------------------------------------
- // End of Script
- // ----------------------------------------------------------------------
-}