Importing Work Calendars

Native Work Calendar records are not importable or creatable with script. However some client side code is still running making it possible to bulk enter the form without too 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 follow code. Replace csv with the entire contents of the csv file, keeping the enclosing back-ticks. Hit Enter to run.

          `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