How to get the integer value of invoice recordType...
# ask-stanley-ai
i
How to get the integer value of invoice recordType when I use relatedRecords in email.send function in Suitlet?
c
AI generated answer (using internal Slack threads):
To get the integer value of the invoice recordType when using relatedRecords in the email.send function in a Suitlet, you need to use the recordType property in the relatedRecords object. This property should be set to the internal ID of the record type, which in the case of an invoice, is the internal ID of the invoice record. Here is a sample code snippet:
Copy code
javascript
var senderId = -5;
var recipientEmail = '<mailto:notify@myCompany.com|notify@myCompany.com>';
var recipientId = 12;
var invoiceId = 123; // replace with your invoice id
var fileObj = file.load({
    id: 88
});
email.send({
    author: senderId,
    recipients: recipientId,
    subject: 'Test Sample Email Module',
    body: 'email body',
    attachments: [fileObj],
    relatedRecords: {
        entityId: recipientId,
        transactionId: invoiceId
    }
});
In this example, the
transactionId
property in the
relatedRecords
object is set to the internal ID of the invoice record. This will attach the email to the invoice record. ****** 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.805466592
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803932548
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.803635299
Please provide your feedback on this answer.