How to Update Custom Calendar Date Definitions

Follow

The calendar can be updated programmatically using the AddHolidays sample job which is located in the Samples folder.  The AddHolidays sample job source will need to be customized for your holiday calendar.  

 

Each calendar date update portion of the script looks like the following:

 

$newdate = ConvertTo-Date "1st day of year" -today $baseDate

$holiday = New-Item JAMSHost:\Dates\Holidays\ -value ("{0:yyyy-MM-dd}" -f $newdate) -force

$formattedDate= "{0:yyyy-MM-dd}" -f $newdate

$holiday = Get-Item JAMSHost:\Dates\Holidays\$formattedDate

$holiday.Description = "New Years Day"

$holiday.Workday = $false

$holiday.Update()

 

All of the items marked in Red will need to be customized for your application.  The first line contains the language specification for the day you want to mark off.  The second line references the Date Definition that you are updating.  The 4th line is the same reference to the date definition.  The 5th line is a short description of the day that is being added.  The 6th line is setting whether the date definition is a workday or not. The rest is powershell language used to perform the update through JAMS.

 

Users can then run the AddHolidays job at the end of every year and it will populate the days for next years calendar.

Have more questions? Submit a request

Comments