Skip to main content
Participant
Sep 22, 2021 4:21 PM UTC
Question

JavaScript for making sequential number field generate new number on printing

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 is closed to new replies. Start a new post to keep the conversation going.

1 reply

try67
Community Expert
Community Expert
Sep 22, 2021 4:52 PM UTC

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

Translate