From 768c37fe8df846f0003da57fa7312cd7b3f0fdd3 Mon Sep 17 00:00:00 2001 From: Sachin Narayanasamy <132642563+SachinNarayanasamy@users.noreply.github.com> Date: Sun, 19 Oct 2025 20:24:32 +0530 Subject: [PATCH 1/2] Create 01Readme.md --- .../01Readme.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Client-Side Components/UI Actions/Set Incident Priority Critical/01Readme.md diff --git a/Client-Side Components/UI Actions/Set Incident Priority Critical/01Readme.md b/Client-Side Components/UI Actions/Set Incident Priority Critical/01Readme.md new file mode 100644 index 0000000000..ebb4f82392 --- /dev/null +++ b/Client-Side Components/UI Actions/Set Incident Priority Critical/01Readme.md @@ -0,0 +1,63 @@ +Set Incident Priority to Critical — UI Action + +This ServiceNow UI Action allows you to quickly mark an incident as Critical directly from the form. It’s designed to make urgent incidents stand out and ensures that key fields are updated in a consistent way. + +Purpose / Use Case: + +Sometimes incidents require immediate attention. Instead of manually updating multiple fields, this button helps you: + +Mark the incident as Critical. + +Assign it to yourself (the logged-in user). + +Add a note in the description indicating that it was marked Critical and by whom. + +Provide a visual message confirming the change. + +This makes it easier for teams to prioritize urgent incidents and track who made the update. + +How It Works: + +Appears as a button on the incident form. + +Clicking it will first check if the incident is already Critical. + +Prompts a confirmation message before applying changes. + +Updates relevant fields and appends a note to the description. + +Displays an informational message so the user knows the incident has been updated. + +Note: Changes happen on the form only. The incident record in the database is updated only after you save or update the form. + +Installation / Setup: + +Navigate to System Definition → UI Actions in ServiceNow. + +Click New to create a UI Action. + +Configure the following: + +Name: Set Priority to Critical + +Table: Incident + +Form Button: Checked + +Client: Checked + +List: Unchecked + +Paste the script into the Onclick field. + +Save and test on an incident form. + +Usage: + +Open an incident form. + +Click the “Set Priority to Critical” button. + +Confirm the action when prompted. + +Review the description note and save the record to update the database. From 6ee5c2cce657cf83d6aaa94a652392d260e3d7e7 Mon Sep 17 00:00:00 2001 From: Sachin Narayanasamy <132642563+SachinNarayanasamy@users.noreply.github.com> Date: Sun, 19 Oct 2025 20:25:22 +0530 Subject: [PATCH 2/2] Create Set Incident Priority to Critical.js --- .../Set Incident Priority to Critical.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Client-Side Components/UI Actions/Set Incident Priority Critical/Set Incident Priority to Critical.js diff --git a/Client-Side Components/UI Actions/Set Incident Priority Critical/Set Incident Priority to Critical.js b/Client-Side Components/UI Actions/Set Incident Priority Critical/Set Incident Priority to Critical.js new file mode 100644 index 0000000000..4feb5e5cf1 --- /dev/null +++ b/Client-Side Components/UI Actions/Set Incident Priority Critical/Set Incident Priority to Critical.js @@ -0,0 +1,25 @@ +function test() { + // Check if incident is already Critical + if (g_form.getValue('priority') == '1') { + alert("This incident is already Critical. No changes were made."); + return; + } + + // Show confirmation dialog + var proceed = confirm("Are you sure you want to set this incident as Critical?"); + if (!proceed) return; + + // Set fields on the form + g_form.setValue('impact', 1); // High impact + g_form.setValue('urgency', 1); // High urgency + g_form.setValue('priority', 1); // Critical + g_form.setValue('assigned_to', g_user.userID); + + // Append note to description + var currentDesc = g_form.getValue('description') || ''; + var note = "Priority set to Critical by " + g_user.getFullName() + " at " + new Date().toLocaleString(); + g_form.setValue('description', currentDesc + "\n" + note); + + // Feedback message + g_form.addInfoMessage("Incident marked as Critical. Remember to save or update the record."); +}