Attachment
Introduction
Version compatibility
This feature was introduced in version 4.72.0 of the JourneyApps Runtime.
The Attachment API can be used in JavaScript/TypeScript (or CloudCode) to populate attachment
, photo
or signature
fields that can bound to components like capture-file
, capture-photo
, capture-signature
, display-file
etc.
Syntax
To create an attachment, use the Attachment.create(options)
function where options
may include
You need to provide one of data
, base64
or text
, depending on the type of data you have.
You also need to provide either mediaType
or filename
, or both. If only one is provided, the other will be automatically assumed. For example:
if only the
filename
is given astest.txt
, themediaType
will be assumed astext/plain
.If only the
mediaType
is given astext/csv
, the filename will be the ID of the object, e.g.334c3c80-afed-4641-b083-9d1871705a6b.csv
.
Example
Consider a variable like the following:
That PDF can be created like this:
Other examples:
Last updated