Skip to main content
timothyd19876369
Participant
Jan 22, 2021 2:17 PM UTC
Question

automatically Checkbox Checked if filename contains specific word (adobe dc javascript)

Hi,

I am hoping someone maybe able to help. I have been looking through but nothing is specifically working for what I need.

I basically have a pdf with some document level javascript but would like to add some more.

Basically there are 5 checkbox each saying a deptartment like 'Finance'

I was wondering if I could get the checkbox to check when the document is automatically opened and it looks for specific string that contains (so it might have other text around it) "Finance"

 

So for example Filename: 'Document Invoice - Finance - 1234.pdf'

Ideally because the document title includes finance it would automatically check the textbox called 'Finance' on the PDF form? If finance wasn't there it wouldn't check the box at all

Any help would be much appreciated.

 

Many thanks,

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

try67
Community Expert
Community Expert
Jan 22, 2021 4:15 PM UTC

Sure, that's possible. You can do it using this script:

this.getField("Finance").checkThisBox(0, /Finance/.test(this.documentFileName));

Translate
timothyd19876369
Participant
Jan 30, 2021 9:13 AM UTC

Hi Try67,

 

This is amazing 🙂 Thank you so much worked first time no problems at all!

Translate