Removes an attachment in the document.
Parameter |
Description |
fieldName |
The name of the item containing the attachment. |
attachmentName |
The name of the attachment. |
Return value |
Description |
boolean |
True if the attachment is successfully removed;
false otherwise. |
Examples
This button onclick event removes
an attachment from the body item if it exists.
if (document1.getAttachmentList("body").isEmpty()) {
requestScope.alist = "No attachments in body";
} else {
if (document1.removeAttachment("body", requestScope.rname)) {
document1.save();
requestScope.alist = "Attachment " + requestScope.rname + " removed from body";
} else {
requestScope.alist = "Attachment " + requestScope.rname + " does not exist";
}
}