Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to get the current PDF filename?

Avatar

Level 1

Hi everyone,

I know this might be a question that has been asked millions of times but I couldn't find a direct answer.

I'm using a work flow that comes with a Content Manager Solution so it is not Adobe this WF will generate a very long file name (about 30 characters) which will be used as the unique process number.

To move to the next step in the work flow I have to update the table in the database and the record to be updated will use the process number.  What I did is I added a hidden text field to the form which should have the process number on the initialize function.

Now my question is how to get the file name of the opened PDF file??

I'm sure there is a function in JS but I couldn't find the way to do it.

Thanks in advance guys for the help.

Mazen

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Mazen

You can use event.target.documentFileName.

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Mazen

You can use event.target.documentFileName.

Bruce

Avatar

Level 1

Thanks Bruce, it worked.

Here is what I did:

I create a textfield and added this script in initialize event:

==============================================================

var

fileName = event.target.documentFileName;

//removing the file extension

var

vDot = fileName.length-4;

//apply the value to the TxtField

this.rawValue

= fileName.substring(0,vDot);