Importing Work Calendars

You can't import or create native Work Calendar records with scripts, but some client-side code still lets you bulk enter the form without much trouble.

Create a CSV file for the Non Working Days matching the following template. The dates must be formatted YYYY-MM-DD and there must be only 1 comma per line.

          Date,Description
2019-01-01,New Year's Day
2019-04-19,Good Friday
2019-04-22,Easter Monday
2019-12-25,Christmas Day
2019-12-26,Boxing Day 

        

Open the console on the Work Calendar form and paste in the following code. Replace CSV with the entire contents of your CSV file, keeping the back-ticks. Then press Enter to run it.

          `csv`.trim().split(/\n/g).slice(1).map(function(row) {
   row = row.split(',')
    nlapiSelectNewLineItem('workcalendarexception')
    nlapiSetCurrentLineItemValue('workcalendarexception', 'exceptiondate', nlapiDateToString(new Date(row[0])))
    nlapiSetCurrentLineItemValue('workcalendarexception', 'description', row[1])
    nlapiCommitLineItem('workcalendarexception')
}) 

        

General Notices