I'm trying to send an email and attach the message...
# suitescript
b
I'm trying to send an email and attach the message record to a custom record, but it throws an unexpected error. If I try to manually send an email from the custom record, there's only one option available in the Recipient dropdown, and it's my employee record. I suspect that may be a symptom of my issue. I have enabled Mail Merge on the custom record type. Is there something else I need to set/enable for this to work?
Copy code
email.send({
  author,
  recipients,
  subject,
  body,
  relatedRecords: {
    transactionId: invoice_id,
    entityId: project_id,
    customRecord: {
      id: custom_record_id,
      recordType: 367,
    },
  },
  attachments: [pdf],
});