diff --git a/GlideRecord/EscalateInicidents/EscalateIncidents.js b/GlideRecord/EscalateInicidents/EscalateIncidents.js new file mode 100644 index 0000000000..abfbad0f8c --- /dev/null +++ b/GlideRecord/EscalateInicidents/EscalateIncidents.js @@ -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.'); + } +} diff --git a/GlideRecord/EscalateInicidents/readme.md b/GlideRecord/EscalateInicidents/readme.md new file mode 100644 index 0000000000..7ae5052f49 --- /dev/null +++ b/GlideRecord/EscalateInicidents/readme.md @@ -0,0 +1 @@ +Escalate High priority incidents with supported notifications and events diff --git a/UI Actions/Copy Bulk SysIDs/CopyBulkIDs.js b/UI Actions/Copy Bulk SysIDs/CopyBulkIDs.js new file mode 100644 index 0000000000..6b8f15dc49 --- /dev/null +++ b/UI Actions/Copy Bulk SysIDs/CopyBulkIDs.js @@ -0,0 +1,16 @@ +/* +//This action will be able to copy the sysids of multiselected records. + +Table - Global +List Choice - True +Client - True +onClick - copySysIDs() + +Result - All the sysids will be copied as comma-separated strings which you can further copy into a system property for validations + +*/ + +function copySysIDs(){ + var sysIds = g_list.getChecked(); + copyToClipboard(sysIds); +} diff --git a/UI Actions/Copy Bulk SysIDs/readme.md b/UI Actions/Copy Bulk SysIDs/readme.md new file mode 100644 index 0000000000..b84669f492 --- /dev/null +++ b/UI Actions/Copy Bulk SysIDs/readme.md @@ -0,0 +1,19 @@ +Did you ever get any use case where you need to copy SysIDs in bulk from a list view? + +The use case can be: +There is some matrix that you need to validate in your script. +You need to store the sysids in a property. One option is to export the CSV with Sys id field using ?CSV&sysparm_default_export_fields=all method, +then convert in comma separated list. + +![image](https://github.com/user-attachments/assets/90228462-cc67-4a99-b4e0-b1295c46bd67) + +Created this small utility to fasten the process of copying bulk sysids + +1. Navigate to System Definitions > UI Actions > Create New +2. Give the Name of your choice e.g “Copy Bulk SysIDs” +3. Select Table as “Global” so it is available on every list. +4. Tick the Client and List choice field checkbox and call the function in Onclick field +5. Write below code inside the function in Script field. +**var sysIds = g_list.getChecked(); +copyToClipboard(sysIds);** + 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);