How to have Document Level JavaScript run when clicking a button?
Hello!
I am stuck on an issue where I have been attempting to create a button that opens an attached PDF and then autofills its Text Fields based off Text Fields in the original PDF that use the same name. So far, I have added two document level javascripts to the original PDF. In the example below, I trying to have the script pull a first name field from the original PDF.
Name of first doc level script: Auto Pop Test
var NewlyOpenedDoc = app.activeDocs[0];
Name of second doc level script: Text Field Populate
newlyOpenedDoc.getField("First Name").value = event.value = this.getField("First Name").valueAsString;
For the actual button, I have it set to execute a JavaScript on Mouse up to open the PDF attached to the original. This works without issue luckily! However, I have no idea how to get it to call/run the document level script to pull the First Name automatically. If I click the button to open the attached PDF, go back to the original, and click on the Doc JavaScript name inside the JavaScript tool, it will then actually pull the First Name from the original and fill out the First Name in the attached one.
Lastly, in the attached PDF, I also have one doc level script saved and it is:
this.disclosed = true;
Any help is massively appreciated! Thank you!

