Trying to attach a file to an email and i keep get...
# suitescript
l
Trying to attach a file to an email and i keep getting this error: Wrong parameter type: options.attachments is expected as file.File[] when i try to attach it as a file i keep getting this error: Wrong parameter type: options.attachments is expected as array File im trying to attach is in a custom field. Here is my code;
j
You've got to use a file.load() to get the actual file. The getValue just gets the internalid. Below is an example from a recent script I wrote:
Copy code
let warrantyId = contract.getValue('custrecord_warranty_brochure');
let warrantyPDF = file.load({
                id: warrantyId
            });
Then I put the warrantyPDF variable as the attachment in the email section.
l
That makes sense Thank you!