trying to have it such that an email is sent to so...
# suitescript
trying to have it such that an email is sent to someone when a new customer record is created. Im getting an unexpected error that i cant figure out.
Copy code
  "type": "error.SuiteScriptError",
  "message": null,
  "stack": [
  "cause": {
    "type": "internal error",
    "code": "UNEXPECTED_ERROR",
    "details": null,
    "userEvent": "aftersubmit",
    "stackTrace": [
    "notifyOff": false
  "id": "7560594d-942a-4238-906d-636885398952-2d323032322e30342e3038",
  "notifyOff": false,
  "userFacing": false
* @NScriptType UserEventScript * @NApiVersion 2.X * @NModuleScope Public */ define(['N/record','N/log', 'N/email'], function (record, log, email) { function afterSubmit(context){ if (context.type !== context.UserEventType.CREATE) return; //Trigger on record CREATE var objRecord = context.newRecord; //Create object const newCustId =; const senderId = 4346; //senderID of "Don't Reply" const recipientEmail = ''; //for testing email.send({ author: senderId, recipients: recipientEmail, subject: 'SUBJECT', body: 'BODY.', }); } return { afterSubmit : afterSubmit } });
Nothing glaring sticks out for me, but I’d make your senderId a string and your recipients an array.
is it senderid an employee?
@mattdahse Ill give it a shot but API says
accepts numbers and
accepts a single string. @Martin Yes i made an employee named "Don't Reply" for this as recommended by someone else last week.