// --------------------------------- Client Script ----------------------------------------------------
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define([],
function() {
/**
* Function to be executed after page is initialized.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.mode - The mode in which the record is being accessed (create, copy, or edit)
*
* @since 2015.2
*/
function pageInit(scriptContext) {
}
/**
* Function to be executed when field is changed.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.sublistId - Sublist name
* @param {string} scriptContext.fieldId - Field name
* @param {number} scriptContext.lineNum - Line number. Will be undefined if not a sublist or matrix field
* @param {number} scriptContext.columnNum - Line number. Will be undefined if not a matrix field
*
* @since 2015.2
*/
function fieldChanged(scriptContext) {
}
/**
* Function to be executed when field is slaved.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.sublistId - Sublist name
* @param {string} scriptContext.fieldId - Field name
*
* @since 2015.2
*/
function postSourcing(scriptContext) {
}
/**
* Function to be executed after sublist is inserted, removed, or edited.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.sublistId - Sublist name
*
* @since 2015.2
*/
function sublistChanged(scriptContext) {
}
/**
* Function to be executed after line is selected.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.sublistId - Sublist name
*
* @since 2015.2
*/
function lineInit(scriptContext) {
}
/**
* Validation function to be executed when field is changed.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @param {string} scriptContext.sublistId - Sublist name
* @param {string} scriptContext.fieldId - Field name
* @param {number} scriptContext.lineNum - Line number. Will be undefined if not a sublist or matrix field
* @param {number} scriptContext.columnNum - Line number. Will be undefined if not a matrix field
*
* @returns {boolean} Return true if field is valid
*
* @since 2015.2
*/
function validateField(scriptContext) {
}
/**
* 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) {
}
/**
* Validation function to be executed when sublist line is inserted.
*
* @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 validateInsert(scriptContext) {
}
/**
* Validation function to be executed when record is deleted.
*
* @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 validateDelete(scriptContext) {
}
/**
* Validation function to be executed when record is saved.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.currentRecord - Current form record
* @returns {boolean} Return true if record is valid
*
* @since 2015.2
*/
function saveRecord(scriptContext) {
}
return {
pageInit: pageInit,
fieldChanged: fieldChanged,
postSourcing: postSourcing,
sublistChanged: sublistChanged,
lineInit: lineInit,
validateField: validateField,
validateLine: validateLine,
validateInsert: validateInsert,
validateDelete: validateDelete,
saveRecord: saveRecord
};
});
// --------------------------------- Client Script ----------------------------------------------------
// --------------------------------- User Script ----------------------------------------------------
/**
* @NApiVersion 2.1
* @NScriptType UserEventScript
*/
define([],
() => {
/**
* Defines the function definition that is executed before record is loaded.
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord - New record
* @param {string} scriptContext.type - Trigger type; use values from the context.UserEventType enum
* @param {Form} scriptContext.form - Current form
* @param {ServletRequest} scriptContext.request - HTTP request information sent from the browser for a client action only.
* @since 2015.2
*/
const beforeLoad = (scriptContext) => {
}
/**
* Defines the function definition that is executed before record is submitted.
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord - New record
* @param {Record} scriptContext.oldRecord - Old record
* @param {string} scriptContext.type - Trigger type; use values from the context.UserEventType enum
* @since 2015.2
*/
const beforeSubmit = (scriptContext) => {
}
/**
* Defines the function definition that is executed after record is submitted.
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord - New record
* @param {Record} scriptContext.oldRecord - Old record
* @param {string} scriptContext.type - Trigger type; use values from the context.UserEventType enum
* @since 2015.2
*/
const afterSubmit = (scriptContext) => {
}
return {beforeLoad, beforeSubmit, afterSubmit}
});
// --------------------------------- User Script ----------------------------------------------------
// --------------------------------- Map/Reduce Script ----------------------------------------------------
/**
* @NApiVersion 2.1
* @NScriptType MapReduceScript
*/
define([],
() => {
/**
* Defines the function that is executed at the beginning of the map/reduce process and generates the input data.
* @param {Object} inputContext
* @param {boolean} inputContext.isRestarted - Indicates whether the current invocation of this function is the first
* invocation (if true, the current invocation is not the first invocation and this function has been restarted)
* @param {Object} inputContext.ObjectRef - Object that references the input data
* @typedef {Object} ObjectRef
* @property {string|number} ObjectRef.id - Internal ID of the record instance that contains the input data
* @property {string} ObjectRef.type - Type of the record instance that contains the input data
* @returns {Array|Object|Search|ObjectRef|File|Query} The input data to use in the map/reduce process
* @since 2015.2
*/
const getInputData = (inputContext) => {
}
/**
* Defines the function that is executed when the map entry point is triggered. This entry point is triggered automatically
* when the associated getInputData stage is complete. This function is applied to each key-value pair in the provided
* context.
* @param {Object} mapContext - Data collection containing the key-value pairs to process in the map stage. This parameter
* is provided automatically based on the results of the getInputData stage.
* @param {Iterator} mapContext.errors - Serialized errors that were thrown during previous attempts to execute the map
* function on the current key-value pair
* @param {number} mapContext.executionNo - Number of times the map function has been executed on the current key-value
* pair
* @param {boolean} mapContext.isRestarted - Indicates whether the current invocation of this function is the first
* invocation (if true, the current invocation is not the first invocation and this function has been restarted)
* @param {string} mapContext.key - Key to be processed during the map stage
* @param {string} mapContext.value - Value to be processed during the map stage
* @since 2015.2
*/
const map = (mapContext) => {
}
/**
* Defines the function that is executed when the reduce entry point is triggered. This entry point is triggered
* automatically when the associated map stage is complete. This function is applied to each group in the provided context.
* @param {Object} reduceContext - Data collection containing the groups to process in the reduce stage. This parameter is
* provided automatically based on the results of the map stage.
* @param {Iterator} reduceContext.errors - Serialized errors that were thrown during previous attempts to execute the
* reduce function on the current group
* @param {number} reduceContext.executionNo - Number of times the reduce function has been executed on the current group
* @param {boolean} reduceContext.isRestarted - Indicates whether the current invocation of this function is the first
* invocation (if true, the current invocation is not the first invocation and this function has been restarted)
* @param {string} reduceContext.key - Key to be processed during the reduce stage
* @param {List<String>} reduceContext.values - All values associated with a unique key that was passed to the reduce stage
* for processing
* @since 2015.2
*/
const reduce = (reduceContext) => {
}
/**
* Defines the function that is executed when the summarize entry point is triggered. This entry point is triggered
* automatically when the associated reduce stage is complete. This function is applied to the entire result set.
* @param {Object} summaryContext - Statistics about the execution of a map/reduce script
* @param {number} summaryContext.concurrency - Maximum concurrency number when executing parallel tasks for the map/reduce
* script
* @param {Date} summaryContext.dateCreated - The date and time when the map/reduce script began running
* @param {boolean} summaryContext.isRestarted - Indicates whether the current invocation of this function is the first
* invocation (if true, the current invocation is not the first invocation and this function has been restarted)
* @param {Iterator} summaryContext.output - Serialized keys and values that were saved as output during the reduce stage
* @param {number} summaryContext.seconds - Total seconds elapsed when running the map/reduce script
* @param {number} summaryContext.usage - Total number of governance usage units consumed when running the map/reduce
* script
* @param {number} summaryContext.yields - Total number of yields when running the map/reduce script
* @param {Object} summaryContext.inputSummary - Statistics about the input stage
* @param {Object} summaryContext.mapSummary - Statistics about the map stage
* @param {Object} summaryContext.reduceSummary - Statistics about the reduce stage
* @since 2015.2
*/
const summarize = (summaryContext) => {
}
return {getInputData, map, reduce, summarize}
});
// --------------------------------- Map/Reduce Script ----------------------------------------------------
// --------------------------------- Scheduled Script ----------------------------------------------------
/**
* @NApiVersion 2.1
* @NScriptType ScheduledScript
*/
define([],
() => {
/**
* Defines the Scheduled script trigger point.
* @param {Object} scriptContext
* @param {string} scriptContext.type - Script execution context. Use values from the scriptContext.InvocationType enum.
* @since 2015.2
*/
const execute = (scriptContext) => {
}
return {execute}
});
// --------------------------------- Scheduled Script ----------------------------------------------------
// --------------------------------- RESTlet Script ----------------------------------------------------
/**
* @NApiVersion 2.1
* @NScriptType Restlet
*/
define([],
() => {
/**
* Defines the function that is executed when a GET request is sent to a RESTlet.
* @param {Object} requestParams - Parameters from HTTP request URL; parameters passed as an Object (for all supported
* content types)
* @returns {string | Object} HTTP response body; returns a string when request Content-Type is 'text/plain'; returns an
* Object when request Content-Type is 'application/json' or 'application/xml'
* @since 2015.2
*/
const get = (requestParams) => {
}
/**
* Defines the function that is executed when a PUT request is sent to a RESTlet.
* @param {string | Object} requestBody - The HTTP request body; request body are passed as a string when request
* Content-Type is 'text/plain' or parsed into an Object when request Content-Type is 'application/json' (in which case
* the body must be a valid JSON)
* @returns {string | Object} HTTP response body; returns a string when request Content-Type is 'text/plain'; returns an
* Object when request Content-Type is 'application/json' or 'application/xml'
* @since 2015.2
*/
const put = (requestBody) => {
}
/**
* Defines the function that is executed when a POST request is sent to a RESTlet.
* @param {string | Object} requestBody - The HTTP request body; request body is passed as a string when request
* Content-Type is 'text/plain' or parsed into an Object when request Content-Type is 'application/json' (in which case
* the body must be a valid JSON)
* @returns {string | Object} HTTP response body; returns a string when request Content-Type is 'text/plain'; returns an
* Object when request Content-Type is 'application/json' or 'application/xml'
* @since 2015.2
*/
const post = (requestBody) => {
}
/**
* Defines the function that is executed when a DELETE request is sent to a RESTlet.
* @param {Object} requestParams - Parameters from HTTP request URL; parameters are passed as an Object (for all supported
* content types)
* @returns {string | Object} HTTP response body; returns a string when request Content-Type is 'text/plain'; returns an
* Object when request Content-Type is 'application/json' or 'application/xml'
* @since 2015.2
*/
const doDelete = (requestParams) => {
}
return {get, put, post, delete: doDelete}
});
// --------------------------------- RESTlet Script ----------------------------------------------------
// --------------------------------- Mass/Update Script ----------------------------------------------------
/**
/**
* @NApiVersion 2.1
* @NScriptType MassUpdateScript
*/
define([],
() => {
/**
* Defines the Mass Update trigger point.
* @param {Object} params
* @param {string} params.type - Record type of the record being processed
* @param {number} params.id - ID of the record being processed
* @since 2016.1
*/
const each = (params) => {
}
return {each}
});
// --------------------------------- Mass/Update Script ----------------------------------------------------
// --------------------------------- Bundle Installation Script ----------------------------------------------------
/**
* @NApiVersion 2.1
* @NScriptType BundleInstallationScript
*/
define([],
() => {
/**
* Defines the function that is executed before a bundle is installed for the first time in a target account.
* @param {Object} params
* @param {number} params.version - Version of the bundle being installed
* @since 2016.1
*/
const beforeInstall = (params) => {
}
/**
* Defines the function that is executed after a bundle is installed for the first time in a target account.
* @param {Object} params
* @param {number} params.version - Version of the bundle being installed
* @since 2016.1
*/
const afterInstall = (params) => {
}
/**
* Defines the function that is executed before a bundle in a target account is updated.
* @param {Object} params
* @param {number} params.fromVersion - Version of the bundle currently installed
* @param {number} params.toVersion - New version of the bundle being installed
* @since 2016.1
*/
const beforeUpdate = (params) => {
}
/**
* Defines the function that is executed after a bundle in a target account is updated.
* @param {Object} params
* @param {number} params.fromVersion - Version of the bundle currently installed
* @param {number} params.toVersion - New version of the bundle being installed
* @since 2016.1
*/
const afterUpdate = (params) => {
}
/**
* Defines the function that is executed before a bundle is uninstalled from a target account.
* @param {Object} params
* @param {number} params.version - Version of the bundle being uninstalled
* @since 2016.1
*/
const beforeUninstall = (params) => {
}
return {beforeInstall, afterInstall, beforeUpdate, afterUpdate, beforeUninstall}
});
// --------------------------------- Bundle Installation Script ----------------------------------------------------
// --------------------------------- Custom Module Script ----------------------------------------------------
/**
* @NApiVersion 2.1
*/
define([],
() => {
const foo = () => {
}
const bar = () => {
}
return {foo, bar}
});
// --------------------------------- Custom Module Script ----------------------------------------------------
// --------------------------------- Custom Plugin Script ----------------------------------------------------
/**
* @NApiVersion 2.x
* @NScriptType plugintypeimpl
*/
define([],
function() {
return {
};
});
// --------------------------------- Custom Plugin Script ----------------------------------------------------
// --------------------------------- Portlet Script ----------------------------------------------------
/**
* @NApiVersion 2.1
* @NScriptType Portlet
*/
define([],
function () {
/**
* Defines the Portlet script trigger point.
* @param {Object} params - The params parameter is a JavaScript object. It is automatically passed to the script entry
* point by NetSuite. The values for params are read-only.
* @param {Portlet} params.portlet - The portlet object used for rendering
* @param {string} params.column - Column index forthe portlet on the dashboard; left column (1), center column (2) or
* right column (3)
* @param {string} params.entity - (For custom portlets only) references the customer ID for the selected customer
* @since 2015.2
*/
const render = (params) => {
}
return {render}
});
// --------------------------------- Portlet Script ----------------------------------------------------
// --------------------------------- WorkflowAction Script ----------------------------------------------------
/**
* @NApiVersion 2.1
* @NScriptType WorkflowActionScript
*/
define([],
() => {
/**
* Defines the WorkflowAction script trigger point.
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord - New record
* @param {Record} scriptContext.oldRecord - Old record
* @param {string} scriptContext.workflowId - Internal ID of workflow which triggered this action
* @param {string} scriptContext.type - Event type
* @param {Form} scriptContext.form - Current form that the script uses to interact with the record
* @since 2016.1
*/
const onAction = (scriptContext) => {
}
return {onAction};
});
// --------------------------------- WorkflowAction Script ----------------------------------------------------