RE : PDF Attachments || Attachment Create

Hi Matthew

When I use <display-file /> I do get a preview (see screenshot). This was introduced in RVM v4.80

But if you don’t like this, you can create a fullscreen “preview” using the journey.files.viewFile(attachment); syntax from your App JS. Here is a slightly different use case using the same syntax.

That said, if you want to get the URL of the attachment you can do that from CloudCode or via the Backend API

So you can update your original CC task to also save the URL to the object directly after creating/saving the Attachment, you just need to reload it first. Like so.

var report = await pdf.generatePdf({html: generated_html});
var pdfBase64 = await report.toBase64();
inspection.report_eng = await Attachment.create({filename: ‘report_eng.pdf’, base64:pdfBase64});
await inspection.save()

// reload the object to ensure you get the URLs
await inspection.reload();

if (inspection.report_eng.present()) {
  inspection.report_end_url = inspection.report_eng.url();
  await inspection.save();
}

Please see here for the original post and answer on getting Attachment URLs into the runtime