Adding attachments (persistent.addAttachmentsLazy)

You can add files to attachment fields using a script method.

You can use persistent.addAttachmentsLazy to add an attachment.

persistent.addAttachmentsLazy({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 Yes The name of the file that is added.
Content String / String Array Yes A Base64 string that represents the content. If this string does not contain a MIME type, Bizzstream tries to add it based on the extension of the file.

Example

persistent.addAttachmentsLazy({
    fieldName: 'attachment',
    lineName: 'orderLines',
    lineId: '1234',
    _id: '12345',
    externalId: '12345_external',
    ddName: 'order'
    fileName: 'file1.jpg',
    content: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAA"
})

results matching ""

    No results matching ""