How to get the filename of the document into the document definition field?
The inbuilt way of getting the image source into the document definition field is using the service field with the ImageSource data source. The result of the hot folder import would look like this:
However, this way is not always useful when we need just the name of the file, not the full path.
In such a case, we can use a regular text field instead of a service field and populate the value using the script rule with the following code:
Context.Field("FieldAlias").Text = Context.Document.Pages.ImageSourceFileSubPath;
The produced result will look like this: