sending email netsuite

Solutions on MaxInterview for sending email netsuite by the best coders in the world

showing results for - "sending email netsuite"
Jacobo
23 Jun 2016
1/**
2 * @NApiVersion 2.x
3 * @NScriptType UserEventScript
4 * @NModuleScope SameAccount
5 */
6define(['N/record','N/email'],
7/**
8 * @param {record} record
9 */
10function(record,email) {
11   
12    /**
13     * Function definition to be triggered before record is loaded.
14     *
15     * @param {Object} scriptContext
16     * @param {Record} scriptContext.newRecord - New record
17     * @param {string} scriptContext.type - Trigger type
18     * @param {Form} scriptContext.form - Current form
19     * @Since 2015.2
20     */
21    function beforeLoad(scriptContext) 
22	{
23		log.debug("Testing user Events");
24		var rec=scriptContext.newRecord;
25		var firstname=rec.setValue({fieldId:'firstname',value:'Abhi'});
26    	
27      
28
29    }
30
31    /**
32     * Function definition to be triggered before record is loaded.
33     *
34     * @param {Object} scriptContext
35     * @param {Record} scriptContext.newRecord - New record
36     * @param {Record} scriptContext.oldRecord - Old record
37     * @param {string} scriptContext.type - Trigger type
38     * @Since 2015.2
39     */
40    function beforeSubmit(scriptContext) {
41		var jobtitle=scriptContext.newRecord;
42		jobtitle.setValue('title','customer');
43		log.debug({
44			title :"BeforeLoad Event",
45		details : "type="+scriptContext.type
46		}); 
47    	
48		
49    	
50
51    }
52
53    /**
54     * Function definition to be triggered before record is loaded.
55     *
56     * @param {Object} scriptContext
57     * @param {Record} scriptContext.newRecord - New record
58     * @param {Record} scriptContext.oldRecord - Old record
59     * @param {string} scriptContext.type - Trigger type
60     * @Since 2015.2
61     */
62    function afterSubmit(scriptContext) {
63	//	var currentuser = runtime.getCurrentUser().id;
64		var currentRecord = scriptContext.newRecord;
65		var visitorname =currentRecord.getValue({
66			fieldId:"firstname"
67          
68		});
69    
70      
71		 email.send({
72								 author:-5,
73								 recipients: ['jayaram.panchakarla@gmail.com'], // emails,
74								 subject: 'testing',
75								 body: 'test',
76							});
77    	log.debug('email sent')
78    }
79    
80    	
81
82
83    return {
84      beforeLoad: beforeLoad,
85     beforeSubmit: beforeSubmit,
86     afterSubmit: afterSubmit
87    };
88    
89});
90
queries leading to this page
email send netsuitesending email netsuite