attach an email to multiple transactions in suites...
# ask-stanley-ai
r
attach an email to multiple transactions in suitescript
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To attach an email to multiple transactions in SuiteScript, you would need to send one email per transaction and set that transaction as the related record transaction ID. However, this cannot be done in a single call. Here is a sample code snippet:
Copy code
javascript
email.send({
    author: 23130,
    recipients: sendTo,
    subject: subject,
    body: body,
    attachments: [billPayFile],
    relatedRecords: {
        entityId: vendorId,
        transactionId: billPayId
    }
});
In the above code,
billPayId
is the internal id of the transaction. Please note that the
relatedRecords
property starts with a lowercase 'r', not an uppercase 'R'. However, there is no direct way to link transaction attachments to emails. You would need to download them from the transaction's Files tab and attach them again manually. Alternatively, you can use a workflow or script to automatically copy important attachments to a standard File Cabinet folder. This makes them easier to find while composing an email. Please note that some mail servers may remove attachments of certain types (zip, pdf, etc.) based on security rules. If you are facing issues with the email not being attached to the transaction, it could be due to a typo in the property name or an unexpected SuiteScript error. If neither
RelatedRecords
nor
relatedRecords
is working, you may need to further investigate the issue.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.874450743
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835022032
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834716797
Please provide your feedback on this answer.
r
how can I tag the same email to multiple transactions