SuiteScript 2.0 manually add items to communications tab

Add email manually to the communications tab of a transaction

The messages sublist is not editable or dynamic, so you do not add items to it directly. Instead you add to it by sending an email via the N/email.send() API and providing the relevant transaction as a Related Record in the options.

Example :
email.send({
    author: "123",
    recipients: ["test@test.com", "another-test@test.com"],
    subject: "This is an email",
    body: "Probably the best email ever",
    relatedRecords: {
        transactionId: recordId // <-- relevant transaction ID here
    }
});

Leave a comment

Your email address will not be published. Required fields are marked *