• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Spawning Templates On Save (with a catch)

New Here ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

I have a template that spawns x number of times based on a value of a field on the form. The spawn is set to happen when the files is saved. My issue is that when the form is first completed and created it is being done in Netsuite and as fasr as I know there is no way to trigger that script while this process is happening.

 

What the user is currently doing is letting Netsuite fill the pdf and then they download the form, change any field in the form and then revert that field to what it was before so that the save option is avaialble and then saves the form so the spawn is triggered. 

 

My goal is to bypass having the user manipulate a field so that the save option is available and the spawn is triggered. Any ideas on how I can achieve this?

TOPICS
Acrobat SDK and JavaScript

Views

73

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
Community Expert ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

Add the following code as a doc-level script to your file:

 

this.dirty = true;

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
New Here ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

Thanks. After typing my initial message I decided to have the script run on open but only if the page count is more than 1. So far this worked.

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
Community Expert ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

It doesn't bother you it will spawn new pages each time you open the file?

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
New Here ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

LATEST

I have variable before the spawn that gets the total pages and then have an if statement that only runs the spawn if the page count is 1. It's a 1 page form.

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