using *email.send(), i want to attach an email to ...
# ask-stanley-ai
e
using *email.send(), i want to attach an email to multiple transactions records (sales order, invoice and customer payment), is it possible to do as an array with "*transactionId"
c
AI generated answer (using internal Slack threads):
Based on the conversations, it appears that you cannot directly attach an email to multiple transactions using the
email.send()
function in SuiteScript. The function does not support sending one email to multiple transactions in a single call. You would have to send one email per transaction and set that transaction as the related record transaction ID. Here is a code snippet from the conversation that shows how to use `email.send()`:
Copy code
javascript
email.send({
    author: authorId,
    recipients: contactId,
    attachments: [pdfFileRedone],
    relatedRecords: {
        entityId: entityId,
        entityId: contactId
    },
    subject: 'subject',
    body: 'body'
});
In this example, the
relatedRecords
property is used to specify the records related to the email. However, it's important to note that this property can only accept one record per call. If you need to send the email to multiple recipients, you can store a comma-separated list of email addresses in a custom field on the transaction, then reference this field in the "cc" field of the
email.send()
function. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.864563048
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840759337
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831054688
Please provide your feedback on this answer.