This article shows how to create an event by SuiteScript, which occurs every month on a particular day of the month.
The following fields are required for the monthly recurrence pattern:
- start date
The internal id of the Event record is calendarevent. An event record can be created by SuiteScript like below:
var newEventRec = nlapiCreateRecord('calendarevent');The value required for the frequency field is MONTH. It can be set like below:
newEventRec.setFieldValue('frequency', 'MONTH')The value required for the period field is 1, where 1 stands for 'every'.
newEventRec.setFieldValue('period', '1');An example of how to set the startdate to the current date is the following:
var date = new Date(); newEventRec.setFieldValue('startdate', nlapiDateToString(date));The setFieldValue() method can be used to populate other fields according to the used form and once this is completed, the record can be submitted:
var newEventRecId = nlapiSubmitRecord(newEventRec);