Generate a random unique string for invoice number


  1. Add a hidden "string field" form field to your form
  • Choose "String Field" from the add new dropdown.
  • Give the field a name.
  • Check the hidden checkbox.
  • Save
  • Find the short name for the field you just created.
    • Go to the form contents,
    • check the checkbox beside the field you just created.
    • go to the bottom of the contents and click the rename button.
    • The short name is in the top text box.
    • click cancel if you didn't change anything.
  • Add a "Custom Script Adapter" to your form.
    • Give your script a title
    • leave the proxy role to no proxy.
    • copy and paste the following code into the "script Body" box
    • millis = int(DateTime().millis())

      conversion = "0123456789ABCDEFGHIUJKLMNOPQRSTUVWXYZ"

      invoice = []

      while (millis > 0):
      invoice.append(conversion[millis % 36])
      millis -= millis % 36
      millis /= 36

      request.form['YOUR FIELD SHORT NAME'] = ''.join(invoice[:4])+''.join(invoice[4:])
    • Replace "YOUR FIELD SHORT NAME" on the last line with the short name you found in step 2.
    • Click the "Save" button