Skip to main content
jd981965
New Participant
October 23, 2020
Answered

Creating a unique ID or serial number for a form

  • October 23, 2020
  • 3 replies
  • 12786 views

I have a form created, but still a novice. So extended steps may need to be provided(more than likely)- just being honest since I am searching for help.

I have created a form that will be posted in one location and used by multiple people. I need to add a unique id for each as a new document is created. I do have the form set up with a "submit form" to a specific email address as a PDF, for management signature.

 

I do have a read only text field set up named: GL_ID. And I just don't know how to create it to make the magic. This unique identifier can be from 6-8 characters. I would like to attach the magic to the submit button, however it can generate the number upon opening of the document.

 

Please note that any guidance is welcome

jd

This topic has been closed for replies.
Correct answer Nesa Nurani

You can use this code as document level script:

this.getField("GL_ID").value = Math.floor(Math.random() * (99999999-999999) +999999);

Every time you open document it will generate random number in GL_ID field.

 

 

3 replies

JR Boulay
Community Expert
October 23, 2020

PDF format specs. requires an unique ID number for each PDF file, you should use it instead of reinventing the wheel 😉

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/Doc_properties.htm?rhhlterm=docid&rhsyns=%20#XREF_34893_docID

Acrobate du PDF, InDesigner et Photoshopographe
jd981965
jd981965Author
New Participant
October 24, 2020

i looked at that prior to posting, and being honest, it was greek. I am a novice, compared to you guy.... but think of this, I'm a rocket scientist on this stuff to them. i just taught them how to add the signature field, but when i tried to have them add the submit button with it.... i lost them. 🙂 so i know they would not accept hunting that information, oh and those are my superiors..lol

 

Brainiac
October 23, 2020

By the way, you can make it random, easily enough, but that is not guaranteed unique. If it MUST be unique then you are going to need to store all the numbers you have given out in a central place, making this a much more complex process, needing you to pay for a server to be there 24/7 to keep the info.

jd981965
jd981965Author
New Participant
October 23, 2020

the form will be stored on our sharepoint, but i can give up the unique for random. We run a program for free 30 minutes of leave for quality notifications. Unfortunately with telework the employee would not be able to submit the paper, so we have to have soe sort of accounting or a few bad apples will use the leave repeatedly. So basically giving the leave a "serial number" will allow the tracking.

 

Thanks in advance !!

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
October 23, 2020

You can use this code as document level script:

this.getField("GL_ID").value = Math.floor(Math.random() * (99999999-999999) +999999);

Every time you open document it will generate random number in GL_ID field.

 

 

jd981965
jd981965Author
New Participant
October 23, 2020

AWESOME thanks for the response!! now here is the novice part... ummmm where do I place this. sorry and thanks in advance

Nesa Nurani
Community Expert
October 23, 2020

You can also open document level script while in prepare form mode by pressing SHIFT+D

 

After that click "Close" and thats it.