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 +
+
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); 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 @@ + + + + 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 +