I am working on improving the maintenance for my company's equipment via a service ticket. When the service ticket form is filled out and submitted, I would like to have it generate a number (in order) for that document (for ex: 2019-001, 2019-002, 2019-003, etc.). I have seen some similar questions answered but all are having the number created when the document is opened.
Thanks for the help!
Copy link to clipboard
Each of those answers that provided code for generating the number in a document script (when the doc is opened) could also be applied to a button. So you could have a button that says, "Start Service Ticket". The script could clear the form and generate the number.
Now, the problem with generating sequential numbers is keeping track of the numbers, because someone who uses the form at a different computer could create the number used by someone else.
There are several solutions for this.
1) The form is used on only one computer.
2) Numbers are tracked on a server, Form submit is used to get the next number so anyone anywhere can create a new sequential number.
3) A variation on #2 is to have a file on a network drive that tracks the numbers. Then the file works on the local network.
4) Use a naturally sequential source, such as time. These numbers are after on another, but not exactly sequential.
Another good way to handle this is to use a folder level script. This is a script installed in Acrobat, not the form. So it only works for the computers where it is installed. This way the person who gets the ticket can't accidentally change the number by pressing the start button.