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 created creating a Sequence Number. Then, use business rules to populate a control with that Sequence Number (and any associated formatting) at run time.
...
Visual Rule Builder
Set the Condition to a condition of your choice. In this example, I am using a trigger button named “ReadyToSubmit”.
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:Click Finish. Your rule looks like this:
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.)
Code Block var an = _data.getParameter("flow.activity.name"); 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'); } }
At run-The first time , the form runs, it will populate the initial sequence number as defined in your rule:
...
The next time For all subsequent times the form runs, it will populate the next incremented number :
...
each time (101, 102, 103, etc.).
...
FAQs
What happens if the sequence number is generated on two forms at the exact same time?
...