When editing a document either in the forms library or a transaction, you are able to generate a serial number for the form.

After adding a text box to the page, assign that text box to "Serial Number".

After assigning it, you will see the text box text is updated to say Serial Number.

If you are in a transaction document, if you click the preview button, it will show you a serial number similar to the one it will generate. Please note that every time you press preview this serial number will change.