Copy link to clipboard
Copied
Hi,
I have a fillable PDF I have created in Acrobat - I am trying to create a senario where everytime the user opens the master PO form I have created a new PO number is generated sequentially (ideally starting at 0001) in the "Invoice" field of the form.
I have read lots of threads on similar questions, however I am trying to achieve the following:
Can anyone advise me with a possible script/s for this please?
I'm really struggling and would appreciate help!
Thank you,
Anisha
Copy link to clipboard
Copied
The code itself is very simple. However, you need to carefully think about how this will work.
For staters, will this file will only be used by one user? If not, you'll get duplicate numbers, which is probably not what you want. Also, when should this number not update? If you use a script to update it each time the file is opened that will also happen after the user saved it as "PO-Form-0002", for example, and then that number will no longer match the file name, etc.
Copy link to clipboard
Copied
Thanks so much for your reply.
So with that in mind, I do not want the number to update everytime the file is opened as "PO-Form-0002" would need to retain the number 0002 on the form.
Yes, it would potentially be opened by muliple users.
Do you have any ideas on what the best way to go about this would be?
In my attempts so far, I have tried to lock the field "Invoice Field" with a script once the form is filled out in order to retain the 0002 - but that didn't work!
Copy link to clipboard
Copied
One of the following options:
- Use random numbers
- Use a time-stamp
- Use a sequential number but assign it in a single location (eg. on your computer), instead of on the users' computers.
- Use a sequential number but add to it a prefix to identify the computer (or user) on which it was assigned.
Copy link to clipboard
Copied
Thank you,
Could you advise on how I could do this?
Use a sequential number but assign it in a single location (eg. on your computer), instead of on the users' computers.
Copy link to clipboard
Copied
This can be done with a custom-made script that assigns a value to the field, backed by a global variable that keeps track of the last number used. If you have Acrobat Pro you can even use an Action to process multiple files at once.
If you're interested I could develop this script for you (as well as the Action), for a small fee.
You can contact me via [try6767 at gmail.com] to discuss it further.
Copy link to clipboard
Copied
Thanks - this sounds like a great option for me so I can get in touch with you via your email address once I've spoken to my client.
Can I just check if you were to develop the script and it was used in the way you have described would we then be able to achieve the following?
Copy link to clipboard
Copied
No, it won't, since the number will have to be assigned after the fact (as well as renaming the file).
The process will be (more or less):
* User opens master document
* The user completes the form and fills in all the fields
* User saves the file in a specific folder to be processed, or submits it back to the admin via email.
* The admin opens the file and runs a script on it (or uses an Action to process multiple such files) that inserts a value into the Invoice field, and saves the file under the new name.
Copy link to clipboard
Copied
Ok, thanks for outlining the steps for me. I'll take this back to my client and see if it will work!