Skip to content

Removing attachments (persistent.removeAttachmentsLazy)

You can remove files from attachment fields using a script method.

You can use persistent.removeAttachmentsLazy to add an attachment.

persistent.removeAttachmentsLazy([{content}]);
Content Parameter Type Required Description
ddName String Yes The name of the document definition to which the document belongs.
_id String No, either the _id or externalId field should be supplied. The internal ID of the document to which the attachment should be added.
externalId String No, either the _id or externalId field should be supplied. The external ID of the source document.
fieldName String Yes The name of the field to which the attachment has to be added.
lineName String No If the attachment field is part of a line, enter the name of the line here.
lineId String No The ID of the line from which the attachments should be added.
lineExternalId String No, if the lineName field has a value, either the lineId or lineExternalId should be entered. The external ID of the line from which the attachments should be added.
fileName String / String Array No The name of the file that is removed. Either fileName or _id should be provided.
fileId String / String Array No The Id of the file that should be removed. Either fileName or _id should be provided.

Example

persistent.removeAttachmentsLazy([{
    fieldName: 'attachment',
    lineName: 'orderLines',
    lineId: '1234',
    _id: '12345',
    externalId: '12345_external',
    ddName: 'order'
    fileName: 'file1.jpg',
    fileId: '12345'
}])