Skip to main content
Participant
September 22, 2021
Question

JavaScript for making sequential number field generate new number on printing

  • September 22, 2021
  • 1 reply
  • 234 views

Can you tell me how to edit this script to generate the new number upon printing? Currently it changes on saving and opening. 

var f = this.getField("Tracking Number");if (f.value=="") f.value = "0001";else f.value = util.printf("%04d", (Number(f.value)+1));

 

Thank you! 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
September 22, 2021

Move the code to the Will Print event of the document, under Tools - JavaScript - Set Document Actions.