File Name Templates


File Name Templates are applied to the files uploaded to file fields of different objects, for example Projects, Submissions. 

To add a File Name Template:

  • Add a FileNameTemplate field definition to the Project data definition and set the FileNameTemplate attribute's value to be the object type that the template needs to be applied to
  • Go to the Project Settings, click Edit All
  • Find the newly added Field and set it's value to be the desired template.

How to use File Name Templates

The templates are based on HandleBars. The correct file extension will be automatically added. Invalid characters will be replaced with an underscore, _.

The available data fields are as follows: 

Name Description Usage example Example output
Project Object containing the project {{Project.Code}}
"Sample Project"
FieldDefinition Object containing the FieldDefinition to whose field the file was uploaded {{FieldDefinition.Name}}
"Example File Field"
OriginalFileName The original name of the file without the extension {{OriginalFileName}} "YourFileName"
FileId The id (unique number) of the uploaded file {{FileId}} "37047"
OwnerType The type of the owner {{OwnerType}} "Submission"
Name of the owner type Object containing the owner of the file {{Submission.ReferenceNumber}}

Missing fields

Any fields from the template that do not exist in the data will be left empty.

Empty templates

If the provided template generates an empty output, the file will have the following name:
"EmptyFileNameTemplateOutput - {{OwnerType}}.{{FieldDefinition.Name}}{{OriginalFileName}}"

Deleted objects

If for some reason you downloaded a file for a deleted object, it will be named as follows:
"{{FileName}} - Deleted {{file.OwnerType}}" where "FileName" is the original output of the template. Deleted data cannot be merged with the template, so "FileName" will be missing those fields.

Too long file names

If the output of the template is longer than 50 characters it will be truncated and have three dots added at the end.

Including Submission Fields for Contributor Files

This is not recommended. A single contributor can be associated with multiple submissions and so the file could become too long. Please consider using fields from the Submission which are known to be short.
{{#each Contributor.SubmissionContributors}} {{Submission.ReferenceNumber}} {{/each}}