From d5abee31233ff316ee5d4eaa489f60d1fb0db1cb Mon Sep 17 00:00:00 2001 From: Abhishek Thakur <146176327+at8807602@users.noreply.github.com> Date: Wed, 1 Oct 2025 11:53:45 +0530 Subject: [PATCH 1/4] Change approver for any record I have seen many times; approvals go to another person. This script can help to change the approvers quickly. --- .../Change Approver/Change approver for any record | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Change Approver/Change approver for any record diff --git a/Server-Side Components/Background Scripts/Change Approver/Change approver for any record b/Server-Side Components/Background Scripts/Change Approver/Change approver for any record new file mode 100644 index 0000000000..06320dd6a4 --- /dev/null +++ b/Server-Side Components/Background Scripts/Change Approver/Change approver for any record @@ -0,0 +1,7 @@ +var rec = new GlidRecord("sysapproval_approver"); +rec.addQuery("sys_id", "Provide the sys_Id of the record"); // Provide the sys_id of the record in which you want to change the approver. +rec.query(); +if(rec.next()){ +rec.approver = "Provide the sys_id of the user"; // Provide the sys_id of the user for whom you want to trigger an approval +rec.update(); // This will update the approver record. +} From 880f0a0c82803246df7ab1a90a91252730ce8bed Mon Sep 17 00:00:00 2001 From: Abhishek Thakur <146176327+at8807602@users.noreply.github.com> Date: Thu, 2 Oct 2025 11:07:51 +0530 Subject: [PATCH 2/4] Create Get_Number_&_Short_Description This custom test step configuration script helps to get the number and short description based on sys_id of the incident while performing the server dependent steps in ATF (Automated Test Framework). --- .../Get_Number_&_Short_Description | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Custom Test Step/Get_Number_&_Short_Description diff --git a/Custom Test Step/Get_Number_&_Short_Description b/Custom Test Step/Get_Number_&_Short_Description new file mode 100644 index 0000000000..ba5fd3c8fc --- /dev/null +++ b/Custom Test Step/Get_Number_&_Short_Description @@ -0,0 +1,18 @@ +(function executeStep(inputs, outputs, stepResult, timeout) { + + var recordSysId = inputs.u_sys_id; + + var finance = new GlideRecord("incident"); + finance.addQuery("sys_id", recordSysId); + finance.query(); + if (finance.next()) { + outputs.u_number = finance.getDisplayValue("number"); + outputs.u_short_description= finance.getDisplayValue("short_description"); + stepResult.setOutputMessage('Found the record'); + stepResult.setSuccess(); + } else { + stepResult.setOutputMessage('Record not found'); + stepResult.setFailed(); + } + +}(inputs, outputs, stepResult, timeout)); From 54e5b19f36cef224aac4a6588ddb5fd108bc9291 Mon Sep 17 00:00:00 2001 From: Abhishek Thakur <146176327+at8807602@users.noreply.github.com> Date: Thu, 2 Oct 2025 11:14:11 +0530 Subject: [PATCH 3/4] Readme.md Above custom test step configuration script will help to get the "Number" & "Short Description" based on the sys_id of the incident. Let's say while performing any server dependent steps on incident table this custom step configuration script can be very usefullt to retrieve the details, not only about incident or number, short_description. Anybody can utilize this script to create custom step configuration script on different usecases o scenario. Note: You need to define the inputs & outputs for this, in my case I have defined the 'sys_id' as an input and "Number" & "Short Description" as an output to store the values and use it anywhere. Also to make sure you define the "stepResult.setOutputMessage("Successfull")" and "stepResult.setOutputMessage("Unsuccessfull")" --- Custom Test Step/Readme.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Custom Test Step/Readme.md diff --git a/Custom Test Step/Readme.md b/Custom Test Step/Readme.md new file mode 100644 index 0000000000..3354b074ba --- /dev/null +++ b/Custom Test Step/Readme.md @@ -0,0 +1,3 @@ +Above custom test step configuration script will help to get the "Number" & "Short Description" based on the sys_id of the incident. Let's say while performing any server dependent steps on incident table this custom step configuration script can be very usefullt to retrieve the details, not only about incident or number, short_description. Anybody can utilize this script to create custom step configuration script on different usecases o scenario. + +Note: You need to define the inputs & outputs for this, in my case I have defined the 'sys_id' as an input and "Number" & "Short Description" as an output to store the values and use it anywhere. Also to make sure you define the "stepResult.setOutputMessage("Successfull")" and "stepResult.setOutputMessage("Unsuccessfull")" From 22b4449943b29d5166332523604a45dc6ef647ab Mon Sep 17 00:00:00 2001 From: Abhishek Thakur <146176327+at8807602@users.noreply.github.com> Date: Thu, 2 Oct 2025 11:18:43 +0530 Subject: [PATCH 4/4] Delete Server-Side Components/Background Scripts/Change Approver directory --- .../Background Scripts/Change Approver/BgScript.js | 9 --------- .../Change Approver/Change approver for any record | 7 ------- .../Background Scripts/Change Approver/README.md | 3 --- 3 files changed, 19 deletions(-) delete mode 100644 Server-Side Components/Background Scripts/Change Approver/BgScript.js delete mode 100644 Server-Side Components/Background Scripts/Change Approver/Change approver for any record delete mode 100644 Server-Side Components/Background Scripts/Change Approver/README.md diff --git a/Server-Side Components/Background Scripts/Change Approver/BgScript.js b/Server-Side Components/Background Scripts/Change Approver/BgScript.js deleted file mode 100644 index 88c8199066..0000000000 --- a/Server-Side Components/Background Scripts/Change Approver/BgScript.js +++ /dev/null @@ -1,9 +0,0 @@ - -var ab=new GlideRecord('sysapproval_approver'); -ab.addQuery('sysapproval',''); -ab.query(); -if(ab.next()) -{ -ab.approver.setDisplayValue('')'; -ab.update(); -} diff --git a/Server-Side Components/Background Scripts/Change Approver/Change approver for any record b/Server-Side Components/Background Scripts/Change Approver/Change approver for any record deleted file mode 100644 index 06320dd6a4..0000000000 --- a/Server-Side Components/Background Scripts/Change Approver/Change approver for any record +++ /dev/null @@ -1,7 +0,0 @@ -var rec = new GlidRecord("sysapproval_approver"); -rec.addQuery("sys_id", "Provide the sys_Id of the record"); // Provide the sys_id of the record in which you want to change the approver. -rec.query(); -if(rec.next()){ -rec.approver = "Provide the sys_id of the user"; // Provide the sys_id of the user for whom you want to trigger an approval -rec.update(); // This will update the approver record. -} diff --git a/Server-Side Components/Background Scripts/Change Approver/README.md b/Server-Side Components/Background Scripts/Change Approver/README.md deleted file mode 100644 index 6ad244873f..0000000000 --- a/Server-Side Components/Background Scripts/Change Approver/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Use the code to change approver for any record from background script -Replace with sys_id of record for which approval is triggered -Replace with name of user who needs to be set as approver