Answers for "sending email netsuite"

0

sending email netsuite

/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
define(['N/record','N/email'],
/**
 * @param {record} record
 */
function(record,email) {
   
    /**
     * Function definition to be triggered before record is loaded.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.newRecord - New record
     * @param {string} scriptContext.type - Trigger type
     * @param {Form} scriptContext.form - Current form
     * @Since 2015.2
     */
    function beforeLoad(scriptContext) 
	{
		log.debug("Testing user Events");
		var rec=scriptContext.newRecord;
		var firstname=rec.setValue({fieldId:'firstname',value:'Abhi'});
    	
      

    }

    /**
     * Function definition to be triggered before record is loaded.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.newRecord - New record
     * @param {Record} scriptContext.oldRecord - Old record
     * @param {string} scriptContext.type - Trigger type
     * @Since 2015.2
     */
    function beforeSubmit(scriptContext) {
		var jobtitle=scriptContext.newRecord;
		jobtitle.setValue('title','customer');
		log.debug({
			title :"BeforeLoad Event",
		details : "type="+scriptContext.type
		}); 
    	
		
    	

    }

    /**
     * Function definition to be triggered before record is loaded.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.newRecord - New record
     * @param {Record} scriptContext.oldRecord - Old record
     * @param {string} scriptContext.type - Trigger type
     * @Since 2015.2
     */
    function afterSubmit(scriptContext) {
	//	var currentuser = runtime.getCurrentUser().id;
		var currentRecord = scriptContext.newRecord;
		var visitorname =currentRecord.getValue({
			fieldId:"firstname"
          
		});
    
      
		 email.send({
								 author:-5,
								 recipients: ['[email protected]'], // emails,
								 subject: 'testing',
								 body: 'test',
							});
    	log.debug('email sent')
    }
    
    	


    return {
      beforeLoad: beforeLoad,
     beforeSubmit: beforeSubmit,
     afterSubmit: afterSubmit
    };
    
});
Posted by: Guest on September-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language