When working on multiple projects, orders, or processes at the same time, it becomes hard to keep track of all the deadlines and some employees may forget some things now and then.
To make it easier for them, a script can be deployed that can create a calendar event. In this example, when the user chooses “Yes”, the script will create the calendar event in the background and if not, then no event will be created.
/**
@NApiVersion 2.x
@NScriptType ClientScript
@NModuleScope SameAccount
*/
define(['N/record','N/ui/dialog','N/format'],
function(record,dialog,format) {
/**
* Validation function to be executed when sublist line is committed.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.sublistId - Sublist name
*
* @returns {boolean} Return true if sublist line is valid
*
* @since 2015.2
*/
function validateLine(scriptContext) {
var currentRecord = context.currentRecord;
var msg = {
title: 'Create Calendar Reminder',
message: 'Do you want to create an event in your NetSuite calendar to remind you of this?'
};
try{
dialog.confirm(msg)
success();
} catch(e){
failure(e);
}
}
function success(){
var calevent = record.create({type: record.Type.CALENDAR_EVENT});
}
function failure(reason){
}
return {
validateLine: validateLine
};
});
Got any feedback? Let us know in the comments!