Create a Unique Invoice Number




Many organizations use ProntoForms to generate documents like Invoices, Work Orders, and Site Inspections, which may require a unique identifier such as an invoice number.  Though the ProntoForms-generated Form Submission Reference Number is guaranteed unique and may work as an invoice number for many, some organizations may wish to create their own invoice numbers.  Rather than asking users to manually enter an invoice number, or having an admin manually dispatch one, there are a number of ways to dynamically generate a unique number to help your team identify your data records.

To guarantee unique numbers/identifiers, we recommend using either the data record reference number, data record ID, or date/time as part of the expression that you configure.  

Form Submission Reference Number vs. Form Submission Identifier

The Form Submission Reference Number is the ProntoForms system's unique identifier for a submitted form.  It is shown beside each form submission listed in the "Form Submissions" page in the web portal.  The reference number is always unique is composed of a string identifying the date the data record was submitted, and the Form Submission Identifier, in the format "yyyyMMD-##########".  

The Form Submission Identifier is simply the second part of the Reference Number.


Using Data Record Expression Language, the Reference Number is referenced with %r, while the identifier is referenced with %r[id].


Case #1: Name Form Submission Documents with an Invoice Number


As an administrator, you may wish your PDFs or other documents to use a unique Invoice Number or other ID. This can be configured in the basic Document Settings using DREL.

Configure the Document

The Form Submission Document Filename Expression is normally found in the Document configuration under the Document Basics tab:


Sample Expressions:

  • "%a[Customer ID]-%r[id]"  will create a filename like "1234567-1810010000"
  • "INV-%r" will create a filename like "INV-20140622-1810010000"

[ top ] 


Case #2: Create a Unique Invoice Number in the Mobile App


Some organizations may wish to create a unique number (like an invoice number) that displays on the device even before a form is submitted (when the data record reference number does not yet exist); perhaps the invoice number is required to be on the form before the customer signs off on it, or the invoice number must be shown in full on the actual document, not just in the document filename.

This can be done using the digit extraction control type, or a combination of digit extraction and string concatenation.  The best way to guarantee a unique number is to include a reference to a date/time selector or stamp and use digit extraction to strip non-numeric characters.

[ top ]  

Scenario and Desired String

It is easier for you to manage your customers' payments if their invoice number contains their customer number.  The desired string in this scenario is: "(Customer Number)-(date, non-numeric characters extracted)".

[ top ] 

Configuring the Form

Below is a view of the form builder, showing the questions we will use to create the invoice number:

  • A dropdown question - Where the user will select a customer from a list populated by a data source
  • A Date/Time Stamp - The input for the digit extraction question
  • A digit extraction question - This allows you to format the Date/Time stamp however you prefer.
  • A String Concatenation to string it all together and create the invoice number


[ top ] 

Customer ID

The question collecting the Customer Number is a dropdown question referencing a data source (of any type, here named "Customer List") that contains a list of customer name in the "Company Name" column and a list of Customer ID's in the "Customer Number" column.  below is the list in spreadsheet format.


Your mobile users don't know the customer numbers, so it easiest for them to select the customer name, while having the form actually collect the customer number.  In the Data Source configuration section of the dropdown properties, select "Company Name" for the Column displayed in dropdown and "Customer Number" for the Column to use as the answer.


[ top ] 

Date/Time and Digit Extraction

No special configuration is required for the Date/Time Stamp itself; just ensure it is before the digit extraction control.  The digit extraction control has been configured to extract the date in the following format:  yyMMddHHmm


[ top ] 

String Concatenation

In String Concatenation Properties, we can link the above fields together and add some static elements for the sake of formatting.


[ top ] 

On a Mobile Device

  • Note that although the Company Name is shown as the value for the Customer ID question, since "Customer Number" was in the data column, the number is what is used in the invoice number.
  • It may be desirable for some of these questions to be set to "hidden on device" to avoid cluttering your user's screens with unnecessary info.  Note that the "Customer ID" question must be visible somewhere in the form.
  • It may also be desirable  to mark all but the "Invoice Number" question as "hidden in reports."
  • Of course, there does not need to be a page dedicated to this function; the digit extraction and string concatenation questions can collect input values from various locations in your form (as long as the input values occur first), making use of the form information you are already collecting.

[ top ]



Case #3: Create an Invoice Number with the Dispatch Data Destination


If your workflow already includes using the dispatch data destination to dispatch data from one user to another, you have a lot of flexibility in building invoice numbers that can appear in the mobile app.  It is possible to include the data record reference number or identifier (of the form used to dispatch)  in an invoice number shown on the mobile device (in the target form).   In fact, data record expression language can be used to grab many other identifiers from the metadata of the submitted form, like user ID (%u[id]) or form id (%f[id]) that may be useful in building an invoice number.

Note: The Dispatch data Destination is the only dispatching method that allows the use of data record expression language.

[ top ]


String #1: "Form Identifier - Data Record Identifier"

It is possible to build the whole invoice string in your Dispatch Data Destination's "Dispatch Data" section, based entirely on the meta data from the submitted form that created the dispatch, and dispatch the entire invoice number.  In this example we will reference the identifier of the Form itself, as well as the data record ID.

*If using this method, you can also include this invoice number in the name of the dispatched form; read about Data Record Naming

Configure the Data Destination

  • Provide the Unique ID of the question in the Target Form where the invoice number should appear.  This is case sensitive.
  • For the Answers to Dispatch section, enter "%f[id]-%r[id]".  This is all in lowercase.



In the Target Form

Generate Invoice Number in Target Form.png

[ top ]


String #2: "INV(Customer Number)-Data Record ID"

In the "Dispatch Data" section, it is also possible to combine submitted form data with the data record ID  to create an invoice number.  See Case #2 (above) for details on how to populate the customer number in the initial/dispatching form.  Use %a[Question Label] in the data expression to reference the submitted data from the initial form used to create the dispatch. We'll also add some static text to this string.

Configure the Data Destination

  • Provide the Unique ID of the question in the Target Form where the invoice number should appear.  This is case sensitive.
  • For the Data Expression, enter "INV%a[Customer ID]-%r[id]".  This is all in lowercase.



In the Target Form


[ top ]

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request