3 Replies Latest reply on Jun 22, 2017 5:12 AM by tom.seager

    Automatic field number progression (+ 1) when a pdf has been signed, saved and newly opened

    tom.seager

      Hello,

       

      I hope I can find some assistance regarding this. I am creating digital agreements for my workplace, whereby our sales people take this with them on an iPad and sign clients up for a service. The agreements have an agreement number at the top, e.g. "00001".

       

      I need for this to automatically progress when a customer has signed the document and the document has saved, so that when the salesperson next opens the blank document for a new sale the agreement number then says "00002", then "00003" etc.

       

      Could this be achieved? If this would be tricky, would there be a way for a popup or option to open when the document is opened saying something along the lines of "Do you need to progress agreement number" with a yes number that advances it by one, and a no option that does not change this? I think the tricky part of this is that it needs to save with the updated number so it can progress by 1 each time the document is opened anew.

       

      Please help!

       

      For argument's sake the agreement number field is called "Agreement" and the client signature field "Signature"

        • 1. Re: Automatic field number progression (+ 1) when a pdf has been signed, saved and newly opened
          Thom Parker Level 3

          Tough problem, especially on the iPad. 

           

          Mobile devices are tricky because the JS options are severely limited on the good viewers, and there are lots of really crappy PDF viewers that don't even recognize form fields, much less execute code. First, I'd suggest you use the Readdle PDF Expert or Adobe Mobile Reader on the iPad. Readdle is the best, it has much better submit and JavaScript functionality than any other App.

           

          Next, write the script on the regular Acrobat Pro on your desktop.

           

          if(1 == app.alert("increment?",2,1))

             this.getField("Agreement").value =  this.getField("Agreement").value + 1;

           

          Put this in a document script and test it out. If it works for you on the desktop, try it on the iPad with the two PDF viewers I've mentioned above.  If it works, then you have something.

           

          However, you may find this technique problematic, but cause it's all on the client. There is no way to know if the number hasn't already been used, or if a number is skipped. This is especially true if there is more than one iPad doing the submit.

           

          A much better methodology is to use a "presubmit", to the server script that is doing the form processing, and have it search the DB and return an FDF with the correct next number. Only the Readdle Viewer can do this. 

           

          Alternatively you can use a psuedo random number generator to create unique IDs.  Then all these other issues go away.

          1 person found this helpful
          • 2. Re: Automatic field number progression (+ 1) when a pdf has been signed, saved and newly opened
            tom.seager Level 1

            Hi Thom,

             

            Thanks for your detailed and thorough answer, it's much appreciated! I may just have to use the increment option for the time being, unfortunately random numbers is not an option as all our agreements are number chronologically and allow for multiple locations of the same order such as "25567A", "25567/b" and "25567C", as well as second year orders for the same client which have a 1 prefix, for example "125567".

             

            I understand that this is making the whole question more and more complicated.

             

            Could you give me any more basic information regarding the presubmit to the server? What would the company I work for need for this? An online server of sorts that could be accessed by submitting document via email? Sorry for my obvious lack of knowledge regarding servers!

             

            The app we're using on the iPads is indeed Readdle PDF Expert, which I concur has the best capabilities by far.

            • 3. Re: Automatic field number progression (+ 1) when a pdf has been signed, saved and newly opened
              tom.seager Level 1

              Thom,

               

              We're going for a unique pseudo random number. Many thanks for your help! Have a great day,

               

              Tom