How to get the filename of the document into the document definition field?

Question

How to get the filename of the document into the document definition field?

 

Answer

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:

\\FC12\Import\Invoice02.tif

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[0].ImageSourceFileSubPath;

The produced result will look like this:

Invoice02.tif

Have more questions? Submit a request

Comments

2 comments

  • Avatar

    Ajay Kumar Nayak

    Hello, 

    I am getting below issue,

     

    Please help me on this, Attaching the screenshot here.

     

    0
  • Avatar

    Anzhelika Fedko

    Hi Ajay Kumar Nayak,

    As I see, you're already in touch with Customer Support Team.
    So I encourage you to continue the discussion in the ticket.

    0

Please sign in to leave a comment.