To Attach the Customers in the emails

This snippet is to attach the emails sent to the customers in the communication subtab of the corresponding customers

let emailOptions = {

                    author: SENDER.CGL_Accounts, // System user

                    recipients: [emailRecipientId],

                    subject: emailSubject,

                    body: emailBody,

                    (statementFile && { attachments: statementFile.map(s => s.file) }),

                    (customerId && { relatedRecords: { entityId: customerId } })

                };

this is used to attach any attachments along with the email

  (statementFile && { attachments: statementFile.map(s => s.file) }),

this is used to attach the email in the customers communication subtab

  (customerId && { relatedRecords: { entityId: customerId } })

Leave a comment

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