-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewCustNotification.js
More file actions
50 lines (37 loc) · 1.19 KB
/
Copy pathnewCustNotification.js
File metadata and controls
50 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* LCM Group
* NewCustNotifcation.js
* Module Notifies Owner when a new customer record is created
*/
// create new namespace
var custNotify = custNotify || {};
/**
* The recordType (internal id) corresponds to the "Applied To" record in your script deployment.
* @appliedtorecord recordType
*
* @param {String} type Operation types: create, edit, delete, xedit,
* approve, cancel, reject (SO, ER, Time Bill, PO & RMA only)
* pack, ship (IF only)
* dropship, specialorder, ordertimes, (PO only)
* paybills (vendor payments)
*
* @returns {Void}
*/
custNotify.sendEmail = function (type)
{
if(type != 'create')
{
return;
}
var custRecord = nlapiGetNewRecord();
var context = nlapiGetContext();
var employeeRecord = nlapiLoadRecord('Employee', context.getUser());
var recipient = 'davids@uribeconstruction.com';
var subject = 'New Customer Alert!';
var body = '<b>New NetSuite Customer Record</b>'
+ '<br/>Customer Name: '
+ '<br/>' + custRecord.getFieldValue('entityid')
+ '<br/><b>Created By: </b>'
+ '<br/>' + employeeRec.getFieldValue('firstname');
nlapiSendEmail(context.getUser(), recipient, subject, body);
};