Attachment
Type |
Object |
Description |
Object that represents an attachment in an email message sent to an Email Capture plug-in implementation. Each Attachment object contains properties for the attachment file name, attachment type, and the value of the attachment file. |
Methods |
|
Parent Object(s) |
|
Child Object(s) |
n/a |
getName()
Function Declaration |
|
Type |
Object method |
Description |
Returns the file name for an attachment in an email message. |
Returns |
string |
Since |
2015.1 |
Input Parameters |
None. |
Parent object |
Example
function process(email) {
...
var attachments = email.getAttachments();
for (var indexAtt in attachments)
{
logAttachment('att', attachments[indexAtt]);
}
...
function logAttachment(label, attachment)
{
nlapiLogExecution('DEBUG', 'Att - ' + label + ': ' + attachment.getName() + ', ' + attachment.getType());
nlapiLogExecution('DEBUG', 'Att - ' + label + ' - value: ' + attachment.getValue());
}
...
}
getType()
Function Declaration |
|
Type |
Object method |
Description |
Returns the file type of an attachment in an email message as a string. For example, this method returns |
Returns |
string |
Since |
2015.1 |
Input Parameters |
None. |
Parent object |
Example
function process(email) {
...
var attachments = email.getAttachments();
for (var indexAtt in attachments)
{
logAttachment('att', attachments[indexAtt]);
}
...
function logAttachment(label, attachment)
{
nlapiLogExecution('DEBUG', 'Att - ' + label + ': ' + attachment.getName() + ', ' + attachment.getType());
nlapiLogExecution('DEBUG', 'Att - ' + label + ' - value: ' + attachment.getValue());
}
...
}
getValue()
Function Declaration |
|
Type |
Object method |
Description |
Returns a text string for a text file attachment or base-64 encoded string for binary attachment types of an email message. You can use getType() to define the behavior of the plug-in implementation depending on the file type of the attachment. |
Returns |
string |
Since |
2015.1 |
Input Parameters |
None. |
Parent object |
Example
function process(email) {
...
var attachments = email.getAttachments();
for (var indexAtt in attachments)
{
logAttachment('att', attachments[indexAtt]);
}
...
function logAttachment(label, attachment)
{
nlapiLogExecution('DEBUG', 'Att - ' + label + ': ' + attachment.getName() + ', ' + attachment.getType());
nlapiLogExecution('DEBUG', 'Att - ' + label + ' - value: ' + attachment.getValue());
}
...
}