frevvo v11.1 is no longer supported. Please visit the Documentation Directory for our current Cloud Release and other versions.

Sequence Numbers

Many customers use frevvo to build workflows such as Purchase Orders or Invoices that require a sequential number identifier. frevvo has a built-in Sequence Number generator that can be used to populate these numbers in your forms automatically.

You will start by creating a Sequence Number. Then, use business rules to populate a control with that Sequence Number (and any associated formatting) at run time.

Create a Sequence Number

Edit the frevvo Project that contains your form/workflow. Click the Sequence Number tab in the left-side menu.

Click the blue + icon to create a new Sequence Number generator. On the Create Sequence Number page, provide a Name (unique, starts with a letter, US-ASCII characters only, no spaces or special characters), a Description and an Initial Value. Once your Sequence Number is created, only the Description can be edited.

Click Submit to save. You will see the newly created Sequence Number in the list.

Populate the Sequence Number on your Workflow

Edit your workflow. Add a Text control and provide a Name and Label. (This control can be hidden if desired.) The example below will show two options, one with a number only and one formatted.

Select Rules from the Guided Designer toolbar. Create a new rule.

The Visual Rule Builder can be used to create a rule to populate your sequence number. Two functions are availabe:

  • getNextSequenceNumber()

    • This increments the sequence number and displays the new number.

    • The parameter inside the parentheses must be the exact Sequence Number name in quotes. For example, getNextSequenceNumber(“PurchaseOrderNumber”).

  • getSequenceNumber()

    • This displays the current sequence number without incrementing it.

    • The parameter inside the parentheses must be the exact Sequence Number name in quotes. For example, getSequenceNumber(“PurchaseOrderNumber”).


Consider the condition that should be used to trigger your Sequence Number Rule. If you simply populate the number on the form.load event, you may see two potential issues. 1) If the form is started and discarded, the number has still be incremented. The next form will use the next number, and so the number of the discarded form is essentially lost. 2) Reopening this form/step, even in Read Only mode, will re-populate the number.

To avoid these issues we recommend running this rule on form.unload and/or another condition that makes sense for your business requirements. We also always recommend setting the default value, rather than the value, to prevent the rule running again on subsequent form views.


Here are two examples.

  1. Visual Rule Builder

    1. Set the Condition to a condition of your choice. In this example, I am using a trigger button named “ReadyToSubmit”.

    2. Set the Action to <control name> default to getNextSequenceNumber(“<SequenceNumberName”>)
      You may also use the concat() function around the sequence number function(s) in order to provide additional formatting.
      This example shows both functions in the Visual Rule Builder:

    3. Click Finish. Your rule looks like this:

  2. Rule Editor. You can use the javascript rule editor to create a rule like this which runs on the form.unload event for the first step of the flow, and sets the default value (sets a value only if the control was empty.)

    var an = _data.getParameter(""); if (form.unload && an === "Sales"){ //Set the next sequence number only if (Boolean(PO.empty)) { PO.value = frevvo.getNextSequenceNumber('PurchaseOrderNumber'); } //display the current sequence number with formatting if (Boolean(POFormatted.empty)) { POFormatted.value = 'PO-' + frevvo.getSequenceNumber('PurchaseOrderNumber'); } }

The first time the form runs, it will populate the initial sequence number:

For all subsequent times the form runs, it will populate the next incremented number each time (101, 102, 103, etc.).


What happens if the sequence number is generated on two forms at the exact same time?

Sequence Numbers have been implemented to mitigate race condition issues.

Can I use Sequence Numbers in a table?

While we don’t prevent this, it is not recommended and can result in unexpected behavior. For example, if two forms are in progress at the same time row numbers could be interleaved between the two forms.

Can two different workflows pull from the same Sequence Number?

Yes, Sequence Numbers can be used with any forms or workflows in the project without limit. The number is independent of the forms - any form that calls the function to increment it will do so. The next form to call the function will increment to the next number.

Can I reset the Sequence Number?

No. You cannot decrement or reset the number. However, you can create a new sequence number and update your rules to use the new one.