Help

Text and Number Combined Unique but auto generated ID

6274 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Nurul_Islam
4 - Data Explorer
4 - Data Explorer

Is it possible to create a auto generated ID in combination with text and Number…e.g. I need to generate some ID like OHBL20081/OHBL20082

Thanks in advance!
Nurul

3 Replies 3
Emmett_Nicholas
6 - Interface Innovator
6 - Interface Innovator

Without understanding exactly what you mean, you may be able achieve what you need combining the Auto Number and Formula field types.

Auto Number will generate unique numbers, which you can then concatenate to strings by using a formula, e.g. CONCATENATE("OHBL", foo).

Brad_Touesnard
4 - Data Explorer
4 - Data Explorer

Here’s what I’ve done…

I started with the created timestamp…

DATETIME_FORMAT(CREATED_TIME(),'X')

This produces a string like this:

1535390717

People may guess that it’s a timestamp and so it’s sequential and be able to guess the ID of other records, so we add a random number to it to make it look less like a timestamp:

DATETIME_FORMAT(CREATED_TIME(),'X')+3647225632

It’s important that the random number be at least as many digits as the timestamp (10 digits). This yields something like this:

5182611245

Ok great, as long as we have this, each of our IDs will always be unique.

The problem now is that they’re still sequential and so people can guess other record IDs easily enough. So lets create a semi-random string of digits.

RIGHT(DATETIME_FORMAT(CREATED_TIME(),'X'), 4) + LEN({Column name}) + 4321

Here I’m getting the last 4 digits of the timestamp adding the length of the contents of another column and the number 4321. Assuming the contents of the column you choose can vary, this should be a pretty different number for each record.

Now we put the two numbers together separated by a hyphen:

CONCATENATE(
  RIGHT(DATETIME_FORMAT(CREATED_TIME(),'X'), 4) + LEN({Column name}) + 4321,
  "-",
  DATETIME_FORMAT(CREATED_TIME(),'X')+3647225632
)

You should end up with something like this:

9963-5182611245

Now we can dress this up some more if you like, sprinkling in some letters for example:

CONCATENATE(
  "rb",
  RIGHT(DATETIME_FORMAT(CREATED_TIME(),'X'), 4) + LEN({Column name}) + 4321,
  "qka",
  DATETIME_FORMAT(CREATED_TIME(),'X')+3647225632
)

Then you end up with IDs that look like this:

rb9963qka5182611245
rb12828qka5182614001
rb5777qka5182616349

Hi there guys,

I found the post by searching for a solution in a similar case study. The purpose is to create a serial number including letters and numbers too.

Here is a recommended solution for that and I hope it will help you:
How to create field with autogenerated serial number including letters and numbers
ps if you try it, please text me back for your feedback

Thanks
Dimitris Goudis