From 70c2962b777532a3e8b48f2190954f7663d7c3fa Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:57:42 +0530 Subject: [PATCH 1/8] Delete UI Actions/Copy Variable Set directory --- UI Actions/Copy Variable Set/readme.md | 14 ---- UI Actions/Copy Variable Set/scripts.js | 100 ------------------------ 2 files changed, 114 deletions(-) delete mode 100644 UI Actions/Copy Variable Set/readme.md delete mode 100644 UI Actions/Copy Variable Set/scripts.js diff --git a/UI Actions/Copy Variable Set/readme.md b/UI Actions/Copy Variable Set/readme.md deleted file mode 100644 index b959798309..0000000000 --- a/UI Actions/Copy Variable Set/readme.md +++ /dev/null @@ -1,14 +0,0 @@ -This UI action will help create a copy of the Variable set, including the Catalog Client Script, Catalog UI actions and Variable. - -Below Configurations need to be performed on the UI action form on creation - -Table : Variable Set -Active: True -Show Update : True -Client : True -Action name : copyQuestionSet -On Click : clientConfirm() - -### update -To complete a task on issue #745 -Replace JavaScript function confirm() with GlideModal() API. diff --git a/UI Actions/Copy Variable Set/scripts.js b/UI Actions/Copy Variable Set/scripts.js deleted file mode 100644 index 4df46456bc..0000000000 --- a/UI Actions/Copy Variable Set/scripts.js +++ /dev/null @@ -1,100 +0,0 @@ -/****************Client Code****************/ - -function clientConfirm() { - - var actionCallbackOK = function() { - gsftSubmit(null, g_form.getFormElement(), 'copyQuestionSet'); - }; - var actionCallbackCancel = function() { - return false; - }; - - var gm = new GlideModal('glide_confirm_basic',false); //UI page with logic to confirm - gm.setTitle("This will create a copy of this variable set including all variables, choices, UI policies, UI policy actions and client scripts. Do you want to proceed?"); // confirm message to ask for confirmation - gm.setPreference('onPromptComplete', actionCallbackOK.bind(this)); //bind to local function to take action when selected Ok - gm.setPreference('onPromptCancel', actionCallbackCancel.bind(this)); //bind to local function to take action when selected Cancel - gm.render(); -} - -/****************Server Code****************/ -//set some new default values -var name = current.title; -current.title = 'Copy of ' + name; - -//insert a copy of the variable set -var oldid = current.sys_id.toString(); -var newid = current.insert(); -var allVars = {}; - -if (typeof window == 'undefined') { - main(oldid, newid); -} - -function main(oldid, newid) { - - createVariables(oldid, newid); - createCatalogClientScript(oldid, newid); - createCatalogUiPolicy(oldid, newid); -} - -//creates a copy of the variables and associates them to the new variable set -function createVariables(oldid, newid) { - var vars = new GlideRecord('item_option_new'); - vars.addQuery('variable_set', oldid); - vars.query(); - while (vars.next()) { - var varoldid = vars.sys_id.toString(); - vars.variable_set = newid; - var varnewid = vars.insert(); - allVars['IO:' + varoldid] = 'IO:' + varnewid.toString(); - - var qc = new GlideRecord('question_choice'); - qc.addQuery('question', varoldid); - qc.query(); - while (qc.next()) { - qc.question = varnewid; - qc.insert(); - } - } -} - -//creates a copy of the client scripts and associates to the variable set. -function createCatalogClientScript(oldid, newid) { - var ccs = new GlideRecord('catalog_script_client'); - ccs.addQuery('variable_set', oldid); - ccs.query(); - while (ccs.next()) { - if (ccs.type == 'onChange') { - var cv = ccs.cat_variable; - ccs.cat_variable = allVars[cv]; - } - ccs.variable_set = newid; - ccs.insert(); - } -} - -//creates a copy of the UI Policies and associates them to the new variable set -function createCatalogUiPolicy(oldid, newid) { - var cup = new GlideRecord('catalog_ui_policy'); - cup.addQuery('variable_set', oldid); - cup.query(); - while (cup.next()) { - var uipoldid = cup.sys_id.toString(); - cup.variable_set = newid; - var newuip = cup.insert(); - - var cupa = new GlideRecord('catalog_ui_policy_action'); - cupa.addQuery('ui_policy', uipoldid); - cupa.query(); - while (cupa.next()) { - cupa.ui_policy = newuip; - cupa.variable_set = newid; - var cv = cupa.catalog_variable; - cupa.catalog_variable = allVars[cv]; - cupa.insert(); - } - } -} - -//Return the user to the new variable set record -action.setRedirectURL(current); From 8e7daa8d9c7496a762728b4615377227b3a90774 Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:23:55 +0530 Subject: [PATCH 2/8] Create EscalateIncidents Escalate High Priority incident and automate emails --- .../EscalateHighPriorityIncidents/EscalateIncidents | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents diff --git a/GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents b/GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents new file mode 100644 index 0000000000..abfbad0f8c --- /dev/null +++ b/GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents @@ -0,0 +1,13 @@ +// Hours - set hours in a system property, and call below function to escalate +// Support it with the events and notifications + +function escalateHighPriorityCases(hours) { + var gr = new GlideRecord('incident'); + gr.addQuery('priority', '1 - Critical'); + gr.addQuery('opened_at', '<=', gs.hoursAgo(hours)); + gr.query(); + + while (gr.next()) { + gs.eventQueue('incident.escalation', gr, gr.assigned_to, 'Escalation triggered after ' + hours + ' hours.'); + } +} From 6602ce06d710f38edea5b02a9b63b9210b1f858a Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:28:00 +0530 Subject: [PATCH 3/8] Delete GlideRecord/EscalateHighPriorityIncidents directory --- .../EscalateHighPriorityIncidents/EscalateIncidents | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents diff --git a/GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents b/GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents deleted file mode 100644 index abfbad0f8c..0000000000 --- a/GlideRecord/EscalateHighPriorityIncidents/EscalateIncidents +++ /dev/null @@ -1,13 +0,0 @@ -// Hours - set hours in a system property, and call below function to escalate -// Support it with the events and notifications - -function escalateHighPriorityCases(hours) { - var gr = new GlideRecord('incident'); - gr.addQuery('priority', '1 - Critical'); - gr.addQuery('opened_at', '<=', gs.hoursAgo(hours)); - gr.query(); - - while (gr.next()) { - gs.eventQueue('incident.escalation', gr, gr.assigned_to, 'Escalation triggered after ' + hours + ' hours.'); - } -} From 55ee779fdc05776df8706dc481b95c8340bb7c6d Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:02:24 +0530 Subject: [PATCH 4/8] Create FormBackground.xml UI macro to add any image as form background --- UI Macros/FormBackground.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 UI Macros/FormBackground.xml diff --git a/UI Macros/FormBackground.xml b/UI Macros/FormBackground.xml new file mode 100644 index 0000000000..c8cbd798c5 --- /dev/null +++ b/UI Macros/FormBackground.xml @@ -0,0 +1,25 @@ + + + + From 2e460e9ad8758d1accdd511a84ec0f47d1bbe14d Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:04:58 +0530 Subject: [PATCH 5/8] Create FormBackground.xml Add any image as form background --- UI Macros/FormBackground/FormBackground.xml | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 UI Macros/FormBackground/FormBackground.xml diff --git a/UI Macros/FormBackground/FormBackground.xml b/UI Macros/FormBackground/FormBackground.xml new file mode 100644 index 0000000000..c8cbd798c5 --- /dev/null +++ b/UI Macros/FormBackground/FormBackground.xml @@ -0,0 +1,25 @@ + + + + From 375215bce1c90325b1f525ba19a0a3571be84121 Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:07:24 +0530 Subject: [PATCH 6/8] Delete UI Macros/FormBackground.xml --- UI Macros/FormBackground.xml | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 UI Macros/FormBackground.xml diff --git a/UI Macros/FormBackground.xml b/UI Macros/FormBackground.xml deleted file mode 100644 index c8cbd798c5..0000000000 --- a/UI Macros/FormBackground.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - From ce6066c5713b986b71e9b76428b2ca0b25abc626 Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:12:12 +0530 Subject: [PATCH 7/8] Create readme.md Readme file for using UI macro --- UI Macros/FormBackground/readme.md | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 UI Macros/FormBackground/readme.md diff --git a/UI Macros/FormBackground/readme.md b/UI Macros/FormBackground/readme.md new file mode 100644 index 0000000000..73c084f551 --- /dev/null +++ b/UI Macros/FormBackground/readme.md @@ -0,0 +1,42 @@ +# ServiceNow UI Macro - Form Background Macro + +> A lightweight UI Macro to style ServiceNow forms with a custom background and simple element theming + +## Features + +* Adds a full-cover background image to a form (supports cover, center positioning). +* Makes table/form/section backgrounds transparent so the background shows through. +* Easy to customize (image path, label styles, button styles, additional CSS selectors). + +## Requirements + +* ServiceNow instance with admin access. +* An image to set as background + +> ⚠️ Note: This macro uses Jelly/CSS that may not work as expected in some Next Experience workspaces or future UI updates. Test in a non-production instance first. + +## Installation + +1. **Upload the background image** + + * Navigate to **System UI > Images** and upload your background image (e.g., `formbg.png`). + +2. **Create the UI Macro** + + * Go to **System UI > UI Macros** and create a new macro (e.g., `ui_form_background`). + * Copy the example macro content below into the UI Macro. + +3. **Create a UI Formatter** + + * Go to **System UI > Formatters**. Create a new formatter for the target table (for example, `incident` table). + * In the *Formatter* field, reference the macro name you created (e.g., `ui_form_background.xml`). + +4. **Add the Formatter to the Form Layout** + + * Open the form layout for the target table (Form Layout / Form Designer) and place the formatter region on the form. + * Save and open a record to see the background applied. + +## Result + +image + From 8a17d38760a2a5f45dc13ad1c2564c2eb245122f Mon Sep 17 00:00:00 2001 From: Deepak Negi <120473057+dvn-lazywinner@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:28:30 +0530 Subject: [PATCH 8/8] Create Copy Variable Set.xml Copy any Variable Set --- .../Copy Variable Set/Copy Variable Set.xml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 UI Actions/Copy Variable Set/Copy Variable Set.xml diff --git a/UI Actions/Copy Variable Set/Copy Variable Set.xml b/UI Actions/Copy Variable Set/Copy Variable Set.xml new file mode 100644 index 0000000000..abc04fc520 --- /dev/null +++ b/UI Actions/Copy Variable Set/Copy Variable Set.xml @@ -0,0 +1,60 @@ +This XML file does not appear to have any style information associated with it. The document tree is shown below. + + +copy_variable_set +true +false + + + + + +true +true +false +false +false +false + +false + +false +false +false +false +false +false +false +false + + +Copy Variable Set + +100 + +true +false +false +true +sys_ui_action +DHR9657 +2022-03-07 07:33:19 +global +/ +cd0ad092dbc2051005edd9fcd396195a +8 +Copy Variable Set + +global + +global +sys_ui_action_cd0ad092dbc2051005edd9fcd396195a +admin +2023-06-16 10:42:52 +item_option_new_set
+true +false +
+