From 20c2e68b43cac64e54e580f1df7f7410a2dc3d2e Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:11:44 +0530 Subject: [PATCH 1/9] creation of Do Task on weekdays Code that verifies today is weekend or not. If today is not weekend, system can trigger mails or execute scripts or do some other updates based on current data. --- .../Background Scripts/Do Task on weekdays | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Server-Side Components/Background Scripts/Do Task on weekdays diff --git a/Server-Side Components/Background Scripts/Do Task on weekdays b/Server-Side Components/Background Scripts/Do Task on weekdays new file mode 100644 index 0000000000..daab48de35 --- /dev/null +++ b/Server-Side Components/Background Scripts/Do Task on weekdays @@ -0,0 +1,8 @@ +//Code that checks if today is Saturday or Sunday (i.e. Weekend) and if it turns out that today is weekend, do not execute the further logic written. + +var today = new GlideDateTime(); +var day = today.getDayOfWeek(); //returns the day of week as number, Monday = 1, Tuesday = 2, ... Saturday = 6, Sunday = 7 +if(day != 6 && day != 7){ + //Do whatever task or update you want to execute on weekdays be it triggering emails or running scheduled script + gs.print("Today is weekday. Good to execute updates."); +} From 8c978d0c2ac8452697374692399eab3b30767e75 Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:30:47 +0530 Subject: [PATCH 2/9] Create README.md Script for checking today is weekday and execute or trigger next part. --- .../Background Scripts/Execute Logic on Weekdays/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md diff --git a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md new file mode 100644 index 0000000000..b3c22e5004 --- /dev/null +++ b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md @@ -0,0 +1 @@ +Script checks today is weekday and then execute further logic inside if. From 535de2ecb7bd80165c1930e8dcec2b7649f3dd82 Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:35:49 +0530 Subject: [PATCH 3/9] creation of Do Task on weekdays Check if today is weekday and execute the task to be executed everyday except Saturday and Sunday. --- .../{ => Execute Logic on Weekdays}/Do Task on weekdays | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Server-Side Components/Background Scripts/{ => Execute Logic on Weekdays}/Do Task on weekdays (100%) diff --git a/Server-Side Components/Background Scripts/Do Task on weekdays b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays similarity index 100% rename from Server-Side Components/Background Scripts/Do Task on weekdays rename to Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays From de52c4a223648a724e8bec5465371c27bd162638 Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:38:21 +0530 Subject: [PATCH 4/9] Rename Do Task on weekdays to Do Task on weekdays.js --- .../{Do Task on weekdays => Do Task on weekdays.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Server-Side Components/Background Scripts/Execute Logic on Weekdays/{Do Task on weekdays => Do Task on weekdays.js} (100%) diff --git a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js similarity index 100% rename from Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays rename to Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js From f8481a29e219385fbd2271db272bcdb684eb4141 Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:40:45 +0530 Subject: [PATCH 5/9] Update Do Task on weekdays.js --- .../Execute Logic on Weekdays/Do Task on weekdays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js index daab48de35..c4686ff65a 100644 --- a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js +++ b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js @@ -1,4 +1,4 @@ -//Code that checks if today is Saturday or Sunday (i.e. Weekend) and if it turns out that today is weekend, do not execute the further logic written. +//Code that checks if today is not Saturday or Sunday (i.e. Weekend) and if it turns out that today is not weekend, then execute the further logic written. var today = new GlideDateTime(); var day = today.getDayOfWeek(); //returns the day of week as number, Monday = 1, Tuesday = 2, ... Saturday = 6, Sunday = 7 From 9f7ba590f68ba311acbb9b0313520b8c9ad3c8a3 Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:47:29 +0530 Subject: [PATCH 6/9] Update README.md --- .../Background Scripts/Execute Logic on Weekdays/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md index b3c22e5004..3ded664aee 100644 --- a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md +++ b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md @@ -1 +1 @@ -Script checks today is weekday and then execute further logic inside if. +Script that checks today is weekday and then execute further logic inside if block. From 43deb61aa5d5e61c9803312050a9234fe05a2dfa Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:48:15 +0530 Subject: [PATCH 7/9] Rename Do Task on weekdays.js to doTaskonWeekdays.js --- .../{Do Task on weekdays.js => doTaskonWeekdays.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Server-Side Components/Background Scripts/Execute Logic on Weekdays/{Do Task on weekdays.js => doTaskonWeekdays.js} (100%) diff --git a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/doTaskonWeekdays.js similarity index 100% rename from Server-Side Components/Background Scripts/Execute Logic on Weekdays/Do Task on weekdays.js rename to Server-Side Components/Background Scripts/Execute Logic on Weekdays/doTaskonWeekdays.js From 3352f5f7b908f4b43ebe63e46f73f9d6e0f165f8 Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:52:15 +0530 Subject: [PATCH 8/9] Update README.md --- .../Background Scripts/Execute Logic on Weekdays/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md index 3ded664aee..f2c40787b5 100644 --- a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md +++ b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md @@ -1 +1,8 @@ Script that checks today is weekday and then execute further logic inside if block. +This script can also be used in 'Condition' part of Scheduled job, with an answer variable. + +var answer = false; +Code snippet{ inside if condition, set answer = true; } +answer; + +This will ensure Scheduled Script only executes on Weekdays. From d7b5b8f51420c4a79bb6a5f2bee0b695fde8e05b Mon Sep 17 00:00:00 2001 From: GHSayak25 <59216790+GHSayak25@users.noreply.github.com> Date: Thu, 2 Oct 2025 17:16:14 +0530 Subject: [PATCH 9/9] Code Snippet to check specific day and execute task Code validates today is weekend or not and executes the following tasks mentioned. --- .../Background Scripts/Execute Logic on Weekdays/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md index f2c40787b5..a24e7f7596 100644 --- a/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md +++ b/Server-Side Components/Background Scripts/Execute Logic on Weekdays/README.md @@ -1,4 +1,4 @@ -Script that checks today is weekday and then execute further logic inside if block. +Background Script that checks today is weekday and then execute further logic inside if block. This script can also be used in 'Condition' part of Scheduled job, with an answer variable. var answer = false;