From cf4760b204dcbbe073bd56b5a188a967b8c915aa Mon Sep 17 00:00:00 2001 From: Becks Date: Wed, 1 Oct 2025 15:08:33 -0400 Subject: [PATCH 1/6] Create Validate RITM Due Date --- Specialized Areas/ATF Steps/Validate RITM Due Date | 1 + 1 file changed, 1 insertion(+) create mode 100644 Specialized Areas/ATF Steps/Validate RITM Due Date diff --git a/Specialized Areas/ATF Steps/Validate RITM Due Date b/Specialized Areas/ATF Steps/Validate RITM Due Date new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/Specialized Areas/ATF Steps/Validate RITM Due Date @@ -0,0 +1 @@ + From bcb6df1c4a003e807175fe16a6695070dd6e7f38 Mon Sep 17 00:00:00 2001 From: Becks Date: Wed, 1 Oct 2025 15:09:07 -0400 Subject: [PATCH 2/6] Delete Specialized Areas/ATF Steps/Validate RITM Due Date --- Specialized Areas/ATF Steps/Validate RITM Due Date | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Specialized Areas/ATF Steps/Validate RITM Due Date diff --git a/Specialized Areas/ATF Steps/Validate RITM Due Date b/Specialized Areas/ATF Steps/Validate RITM Due Date deleted file mode 100644 index 8b13789179..0000000000 --- a/Specialized Areas/ATF Steps/Validate RITM Due Date +++ /dev/null @@ -1 +0,0 @@ - From 6a91f28475cf72c00a96e3e6bc1612e9e00e8565 Mon Sep 17 00:00:00 2001 From: Becks Date: Wed, 1 Oct 2025 15:19:30 -0400 Subject: [PATCH 3/6] Create README.md file --- Specialized Areas/ATF Steps/Validate RITM Due Date/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Specialized Areas/ATF Steps/Validate RITM Due Date/README.md diff --git a/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md b/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md new file mode 100644 index 0000000000..0266656d38 --- /dev/null +++ b/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md @@ -0,0 +1 @@ +This script will calculate a due date for a given RITM and validate it matches the actual due date. You can use this in a "Run Server Side Script" ATF test step, and requires you to have a previous ATF Test Step that does a Record Query for the RITM record. From f72811114f3134618fb1221a30466a2c0f5cdb04 Mon Sep 17 00:00:00 2001 From: Becks Date: Wed, 1 Oct 2025 15:29:56 -0400 Subject: [PATCH 4/6] Create atf_ritm_due_date_script.js --- .../atf_ritm_due_date_script.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Specialized Areas/ATF Steps/Validate RITM Due Date/atf_ritm_due_date_script.js diff --git a/Specialized Areas/ATF Steps/Validate RITM Due Date/atf_ritm_due_date_script.js b/Specialized Areas/ATF Steps/Validate RITM Due Date/atf_ritm_due_date_script.js new file mode 100644 index 0000000000..e00ce5e3ff --- /dev/null +++ b/Specialized Areas/ATF Steps/Validate RITM Due Date/atf_ritm_due_date_script.js @@ -0,0 +1,27 @@ +(function(outputs, steps, params, stepResult, assertEqual) { + // Calculate what the due date should be and compare to the actual due date + var ritmQuerySysId = ''; // This is the sys id of the Record Query ATF Test Step for the RITM record (NOTE: This needs toe be updated to match your test step) + var grRITM = new GlideRecord('sc_req_item'); + grRITM.get(steps(ritmQuerySysId).first_record); + var calculatedDue; // set up our calculation + + var deliveryTime = grRITM.cat_item.delivery_time.dateNumericValue(); // get delivery time in ms + + if (deliveryTime) { + var dur = new GlideDuration(deliveryTime); + var scheduleID = gs.getProperty('glide.sc.item.delivery_schedule'); // Property contains the sys id of the schedule used for this date calculation + var schedule = new GlideSchedule(scheduleID); + var gdt = new GlideDateTime(grRITM.opened_at); // due date should be set based on the item's opened timestamp + calculatedDue = schedule.add(gdt, dur); + } + + var actualDue = new GlideDateTime(grRITM.due_date); + + testAssertion = { + name: "The Due Dates Match!", + shouldbe: calculatedDue, + value: actualDue + }; + assertEqual(testAssertion); + +})(outputs, steps, params, stepResult, assertEqual); From 481b4a2e55476e61afbfd36c77477feacc6ffe16 Mon Sep 17 00:00:00 2001 From: Becks Date: Wed, 1 Oct 2025 15:59:14 -0400 Subject: [PATCH 5/6] Updated README.md pt 2 --- .../ATF Steps/Validate RITM Due Date/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md b/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md index 0266656d38..c5a6ce1e35 100644 --- a/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md +++ b/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md @@ -1 +1,8 @@ -This script will calculate a due date for a given RITM and validate it matches the actual due date. You can use this in a "Run Server Side Script" ATF test step, and requires you to have a previous ATF Test Step that does a Record Query for the RITM record. +## Description: +This script will calculate a due date for a RITM based off of the delivery date of the Catalog Item and validate it matches the actual due date. + +## Usage Instructions/Examples: +You can use this in a "Run Server Side Script" ATF test step. This is specfic for RITM's and Catalog Item's with Delivery Times + +## Prerequisites/Dependencies: +In your ATF Test Case, you need to create a ATF Test Step that does a Record Query for the RITM record before running this script. The sys id of that Record Query Step is used in the scipt to obtain a GlideRecord of the RITM. From 01391e3463006a78f19c870123ca392653583c44 Mon Sep 17 00:00:00 2001 From: Becks Date: Wed, 1 Oct 2025 16:54:34 -0400 Subject: [PATCH 6/6] Updated README.md file with property dependency --- Specialized Areas/ATF Steps/Validate RITM Due Date/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md b/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md index c5a6ce1e35..1f060e175a 100644 --- a/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md +++ b/Specialized Areas/ATF Steps/Validate RITM Due Date/README.md @@ -5,4 +5,5 @@ This script will calculate a due date for a RITM based off of the delivery date You can use this in a "Run Server Side Script" ATF test step. This is specfic for RITM's and Catalog Item's with Delivery Times ## Prerequisites/Dependencies: -In your ATF Test Case, you need to create a ATF Test Step that does a Record Query for the RITM record before running this script. The sys id of that Record Query Step is used in the scipt to obtain a GlideRecord of the RITM. +1) In your ATF Test Case, you need to create a ATF Test Step that does a Record Query for the RITM record before running this script. The sys id of that Record Query Step is used in the scipt to obtain a GlideRecord of the RITM. +2) You need a system property called "glide.sc.item.delivery_schedule" that contains the sys id of a record on the cmn_schedule table that will be used for the due date calculation