Sequential numbering - auto save upon open
I have the following Java script for a text element within my document. The problem is that the sequential numbering does not work unless the document itself is saved. The form is intended to serve as a master that would be "save as" after it is completed. To prevent user error, I'd like the document to immediately "save" itself after it is opened. Of course there is still user error later if the user clicks save instead of save as - that's my next problem.
Ideally the behavior would be:
user opens master
document immediately saves itself (Java-driven)
user completes document
user SAVES AS a new document
master document is closed
**next time it is opened, the text tracking number updates sequentially
//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------
//<Document-Level>
//<ACRO_source>Document Number</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:Document Number ***********/
var f = this.getField("Tracking Number");
if (f.value=="") f.value = "0001";
else f.value = util.printf("%04d", (Number(f.value)+1));
//</ACRO_script>
//</Document-Level>
