I'm having a problem being able to attach the email to a custom Project record.
I've successfully been able to use the API to send email as long as I only use either entityId as a related record and attach to an employee record or I remove that optional parameter totally.
I've tried using transactionId and I've tried customRecord, both together and alone. In all cases I get an UNEXPECTED_ERROR which has no details at all about what might be wrong.
Does anyone know what I need to do to have this email attached to my Project record?
/**
*@NApiVersion 2.1
*@NScriptType UserEventScript
*/
define(['N/record','N/email','N/search'],function(record,email,search){
function sendEmail(context){
var asxSupportID=2859;
var recipient = 'theEmail@gmail.com';
var projectID=2860;
var recordTypeId=316;
email.send({
author: asxSupportID,
recipients: recipient,
subject: 'Test Sample Email Module',
body: 'email body',
relatedRecords: {
transactionId: projectID,
customRecord: {
id: projectID,
recordType: recordTypeId
}
}
});
}
return{
afterSubmit:sendEmail
}
});