We offer several options for generating a unique number or code on a form output. This is often needed for scenarios like order numbers, invoice codes, document IDs, etc.
One method is to use the Auto-Number field, which you can read more about in this article. This is our recommended option for most scenarios due to several reasons. One advantage is that it automatically keeps track of form entries regardless of user and can be bound to a data source as well displayed in the output. With Generate on Upload enabled, it will also keep the number constant throughout a workflow. This is a powerful option for identifying form submissions to distinguish them from each other outside the form after the user has submitted it.
A unique number or code can also be created by using a formula to create a text value with a function within the Dynamic Value property of a text field. Essentially this will be a concatenation of various bits of data to create a meaningful but reasonably-unique code. Consider combining the date with other elements like the user's metadata to ensure that the resulting code cannot be duplicated for other users or devices. This option offers great specificity and customization, more so than even the auto-number. However, this will not be sequential or cross-user like the auto-number; and it will also, by design, be very specific to local variables. This option is recommended for creating unique identifiers for use within the form -- e.g., tagging each row of a repeating table with the same identifier to allow for filtering based on them in a choices field elsewhere in the form -- or even outside the form like auto-number.
For this option, consider something like counter() concatenated with the userexternalid()/useremail() and possibly with format-date() and today()/now() as well. The External ID on users is particularly useful for storing something like a payroll ID or other codes that have meaning in the ultimate destination system.
Here are some examples of formulae to generate device-specific unique codes:
uuid(10) gives something like: X7E5F3A2L3
random() gives something like: 0.14935942 which you can then multiply/round etc to get the desired precision
counter() gives you a sequentially increasing number that is device-specific.
We strongly recommend joining the device counter() value with date and/or user identifiers, such as these below:
concat(format-date(now(), 'yyyyMMdd'), '-', counter()) gives something like: 20140313-39
concat(format-date(now(), 'yyyyMMdd'), '-', userexternalid(), '-', counter()) gives something like: 20140313-USER1-39
One other option that can be used on the Output Template is the special built-in placeholder called {{%ENTRYID}}. This special placeholder is not currently available for form use in the designer, only being available on the form output. Note that this cannot be bound to a data source like auto-number and will not be visible on the data entry. For more information on this, please refer to the "Built-in Data" article under the Output Templates section of our Knowledge Base.
AUTO-NUM with Generate On Upload | AUTO-NUM without Generate on Upload | Custom Formula | %ENTRYID | |
Sequential | Yes | Yes* | No | Yes |
Cross-user/device | Yes | Yes | No | Yes |
Visible on form to user | Yes** | Yes | Yes | No |
Visible in form data to admin | Yes | Yes | Yes | No |
Visible on output template | Yes | Yes | Yes | Yes |
Customizable | Yes*** | Yes | Yes | No |
*No protection against missing numbers in the sequence
**Only visible on subsequent steps of a workflow after the form has been submitted
***Limited, via the Number Format property
See also:
Auto-Numbering Field Type