Search…
How to add related files to a document
Every case comes with their own related files, which can be uploaded by users or automatically and serve to provide the user with more details about the case.
You can find the related documents by opening a case and navigating to the Documents tab
To upload a file, you can either press the upload button or click and drag a file onto the screen

Adding files programmatically

To add files programmatically you first need a reference to the document you want to add the files to. You should also have the file as a Resource.
Using the JsonSchemaDocumentService we can register the files.
JsonSchemaDocumentService.assignRelatedFile(document.id(), JsonSchemaRelatedFile.from(resource));

Registering files from S3

You can register files from S3 using the S3Resource class. First, make sure the file has been uploaded to S3 and that a record has been saved to the database.
JsonSchemaDocument document = ...
byte[] fileContents = ...
S3Resource resource = s3ResourceRepository.save(new S3Resource(
ResourceId.Companion.newId(UUID.randomUUID()),
"bucketName",
"key",
"fileName",
".extension",
fileContents.length,
LocalDateTime.now())
);
JsonSchemaDocumentService.assignRelatedFile(document.id(), JsonSchemaRelatedFile.from(resource));