• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Create a sequential PO Number (that is saved) in a fillable form every time the document is saved as

New Here ,
Jan 25, 2022 Jan 25, 2022

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.

 

Screenshot1.jpg

 

I have read lots of threads on similar questions, however I am trying to achieve the following:

  • User opens master document
  • The generated number appears in the "Invoice" field e.g. 0002
  • The user then "saves as" on computer and gives the document a name - lets give it the name "PO-Form-0002"
  • The user completes the form and fills in all the fields
  • Saves and closes the form
  • When the document "PO-Form-0002" is reopened I would like the "Invoice" field to maintain the SAME number it generated origianlly - as per this example  it would be 0002. 
  • When the master document is opened next the "Invoice" field generate the number 0003 and the user the saves the file as "PO-Form-0003" and so on.

 

Can anyone advise me with a possible script/s for this please?

I'm really struggling and would appreciate help! 

 

Thank you,

Anisha

TOPICS
Acrobat SDK and JavaScript

Views

297

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

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! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

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?

 

  • User opens master document
  • The generated number appears in the "Invoice" field e.g. 0002
  • The user then "saves as" on computer and gives the document a name - lets give it the name "PO-Form-0002"
  • The user completes the form and fills in all the fields
  • Saves and closes the form
  • When the document "PO-Form-0002" is reopened I would like the "Invoice" field to maintain the SAME number it generated origianlly - as per this example  it would be 0002. 
  • When the master document is opened next the "Invoice" field generate the number 0003 and the user the saves the file as "PO-Form-0003" and so on.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022

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.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

Copy link to clipboard

Copied

LATEST

Ok, thanks for outlining the steps for me. I'll take this back to my client and see if it will work!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines