Run a calculation script on import

New Here ,
Jun 04, 2019 Jun 04, 2019

Copy link to clipboard

Copied

I have a script in a field that takes 3 other fields and formats them into 1 address field that is formatted nicely.

Works great if the user is inputting them in but I would like it to work if I import data into those 3 fields - but it is not.

Code is below. I have this as a calculation script:

event.value = this.getField("shipper_name").value + "\n"

+ this.getField("shipper_address1").value + "\n";

if (this.getField("shipper_address2").value!="")

    event.value += this.getField("shipper_address2").value + "\n";

event.value += this.getField("shipper_city").value + ", "

+ this.getField("shipper_state").value

+ " " + this.getField("shipper_postal_code").value;

I figure it has to do because the script is triggered only after the field is existed and when importing no field is getting entered/exited - therefore the script does not run.

Is there a way to have the script trigger when the data is imported or maybe when the file is opened?

TOPICS
Acrobat SDK and JavaScript

Views

66

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 04, 2019 Jun 04, 2019

Copy link to clipboard

Copied

LATEST

When the data is imported: Only if you do it using a script.

When the file is opened: Sure. Add this code as a doc-level script (not inside a function):

this.calculateNow();

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines