Monday, April 29, 2019

Create Work Calendar Record Using User Event Script

The following sample script demonstrates, how Work Calendar record can be created.

The format of the mandatory fields is as follows:
Name [Free-Form Text] - e.g. "Warehouse Calendar"
Start Hour [Free-Form Text] - e.g. "8:30 am" or e.g. "2:00 pm"
Hours Per Day [Decimal] - e.g. "9.50"



  var newWorkCalendar = nlapiCreateRecord('workcalendar'); 
newWorkCalendar.setFieldValue('name', 'Warehouse Calendar'); 
newWorkCalendar.setFieldValue('starthour', '8:30 am'); 
newWorkCalendar.setFieldValue('workhoursperday', '9.50'); 
nlapiSubmitRecord(newWorkCalendar);




Note: To review the Internal ID for other Work Calendar record fields, navigate to Lists > Employees > Work Calendars > New and click on the field name. Make sure to have Show Internal IDs (Home > Set Preferences > General tab) checkbox turned on to be able to see the Internal IDs.

No comments:

Post a Comment