- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2016 10:20 PM
Do I have to check "glide.schedules.repeat_nth" property and set it to Day??
I also wrote this script:
var now = New DateTime();
var day = now.getDay();
gs.log("Day is :" + " " +day);
if( day == 3)
{
var rec1 = new GlideRecord("incident");
rec1.initialize();
rec1.applyTemplate("Test");
rec1.insert();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2016 11:08 PM
Hi Shreya,
Please find the script to be written in conditional, this should work -
function checkThirdTuesday(workDay){
var ordinals = ["", "1", "2", "3", "4", "5"];
var date = String(new Date());
var tokens = date.split(" ");
var floatNumber = ordinals[Math.ceil(tokens[2]/7)];
var weekDay = tokens[0];
if(floatNumber == "3" && weekDay == workDay)
result = true;
else
result = false;
return result;
}
checkThirdTuesday('Tue');
Hopefully it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 02:29 AM
Hi All
Similar request is to run a Job at every month last Saturday. There is a Schedule Job which I need to execute on last Saturday of every month.
Any suggestion..
Regards
Ranjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2017 05:07 AM
Thanks Dan, how would I enter the 17 day and 2nd Tuesday without creating another script to call the ManintanaceScedule. Can I just enter those values in the original script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 12:03 AM
Hi All
By using same solution how can I get a schedule Job run at Last Saturday of every month? If anyone suggest will be helpful to get information
Regards
Ranjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2018 02:01 AM
function checkSecondFriday(workDay){
var ordinals = ["", "1", "2", "3", "4", "5"];
var date = String(new Date());
var tokens = date.split(" ");
var floatNumber = ordinals[Math.ceil(tokens[2]/7)];
var weekDay = tokens[0];
var gdt = new GlideDateTime("Put today's date here"); // use value coming from 'date' variable
gs.info(gdt.getDayOfWeekLocalTime());
var day = gdt.getDayOfWeekLocalTime(); // here you check first date of every month coming on which day
if( day == 1 || day ==2 || day ==3 ||day ==7) // if first date of a month comes on Monday/Tuesday/Wedneday/Sunday then 4th saturday is last Saturday
{
if(floatNumber == "4" && weekDay == workDay)
answer = true;
else
answer = false;
return answer;
}
else if( day == 4|| day == 5|| day == 6) // If first date of a month comes on Thursday/Friday/Saturday then 5th Saturday is last saturday
{
if(floatNumber == "5" && weekDay == workDay)
answer = true;
else
answer = false;
return answer;
}
checkSecondFriday('Sat');
Please hit, like or helpful.