Skip to main content
Nintex Community Menu Bar

Unique sequences for new requests in forms

  • July 15, 2026
  • 2 replies
  • 14 views

Callan.Applebee
Forum|alt.badge.img+2

Hi Team, 

I have been struggling to find a suitable way to ‘generate’ a unique form code for ‘booking number’ or a dedicated ‘reference number’ when requested by stakeholders/customers.

At first - needing to leverage another system to do a count (SharePoint Online) to provide a number in the line and using format date, did work BUT if someone else submitted a form before you the count number was used and therefore would not be unique causing some duplication. The way to combat that was to enforce a unique field validation on the associated SharePoint column (i.e Title / Booking Number). This kind of worked but would cause the Nintex workflow to FAIL as SharePoint would say no.

Instead of making the simple form and workflow complex (could add a Loop N and delay etc) i opted for another way which I think worked a treat especially as i needed to display the Booking Number on the form and have it throughout the process for emails and such. This was a pain point to start with as the original code , would display one thing but then by the time the email triggered because of the formatting, the Booking Number changed.

My Solution was this

Add a text Field - read only

Then create a rule to populate that text

 

Now the ‘Booking Number’ variable was created by building this 

 

formatDate(dateNow(),"YY-MM-DD")+"-"+formatDate(dateNow(),"HHMMSS")+convertToString([Form].[Item Count])

 

After a few attempts I had to add in the HHMMSS to make sure it was unique otherwise multiple attempts if using

 formatDate(dateNow(),"YY-MM-DD")+"-"+convertToString([Form].[Item Count])

would mean the issue of duplicate would occur if the count did not update should 2 people use the form at the same time.

 

So NOW by referencing the text field that populates the first time and capture using that and not the variable, SPO and emails should by consisent

 

 

Has anyone else run into this Or has a similar or better way to build bespoke sequences in Nintex Automation Cloud?

2 replies

Forum|alt.badge.img+11
  • Nintex Employee
  • July 15, 2026

Hi ​@Callan.Applebee 

The time methodology isn’t bad.  I’d probably combine it with a generated GUID and do this in a single variable.  Here’s the formula I used to generate something similar in a variable:

formatDate(dateNow(),"YY-MM-DD-hhmmss") + padLeft(substring(replace(replace(newGuidAsString(),"-",""),"[a-zA-Z]",""),0,6),6,"0")

That makes it so that the time is used as a first controlling factor on the control number, then you’re appending a random integer to the end (in the case I gave 6 digits).  So even if someone loads the form at the same second as another person there’s a 1 in 1,000,000ish chance they’d have the same control number.

 


Callan.Applebee
Forum|alt.badge.img+2

Thanks ​@brent_read

Also comes down to what the bespoke reference number the customer requests to be which makes Nintex’s use case tricky sometimes. 

Appreciate the additional information and that code sample as I have only built from existing knowledge and used the same or similar code from another application I used to use and now need to rebuild / migrate all forms and workflows off of and get them into Nintex Workflows.