snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Auto generation of Asset Tags

Open gitneko opened this issue 5 years ago • 11 comments

Server (please complete the following information):

  • Snipe-IT Version 4.9.4
  • OS: [e.g. Ubuntu, CentOS] Linux
  • Web Server: [e.g. Apache, IIS] Apache
  • PHP Version 7.2.29

Is your feature request related to a problem? Please describe. It should be possible to generate asset tags according to some scheme (i.e. A-Z,0-9). Currently the only way to have an automated way of creating asset tags is through an autoincrement. Many companies use this scheme of asset tags instead of an auto incremented numeric tag.

Describe the solution you'd like I'd like to be able to generate an asset tag through a randomized string of characters.

Describe alternatives you've considered I don't think there are any alternatives to this. Doing this all by hand is not intuitive.

gitneko avatar Aug 28 '20 11:08 gitneko

I don't really understand what you mean here though. How would this actually work?

snipe avatar Aug 29 '20 01:08 snipe

Although not the proposer :-) you might think of some template variables. I have been working in several copanies and my current one uses a country code, an asset type code, a number and an OS addition to construct an asset ID like USL20117W, which basically means a US (L)aptop, number, (W)indows. Others used a formula with date strings in them so you could determine from the asset ID when it was installed for the first time (20200905_175). So it can be rather complex, but I think that if you just could define them as variables (%YY%, %MM%, %DD%, %Country%, %Type%, %OS% for the ones I named) together with a number that you can enter yourself, or get an auto incremented number would give enough possibilities, however the possibilities can be endless ;-)

kgortmak avatar Sep 10 '20 06:09 kgortmak

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

stale[bot] avatar Dec 25 '20 17:12 stale[bot]

I'd say it's still relevant. I've been running a homegrown system for years, and am now transitioning to Snipe-IT. I would create asset tags based on random 4 character strings, using A-Z and 0-9, but excluding 0, 1, O, I, and L (l). It was the first feature I went looking for while configuring Snipe-IT. @kgortmak kind of nailed it with the implementation idea. For me, I had about 5 different templates, which were as simple as TXXX for tools, EXXX for equipment, DXXX for devices, SXXX for spare parts and BXXX for box (container).

theukedge avatar Jun 01 '24 03:06 theukedge

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

stale[bot] avatar Jun 01 '24 03:06 stale[bot]

Every time time this comes up, no one can really explain how this would work for the numeric part exactly though? Most people who want a prefix of some kind want it based on company, department, category, etc, followed by an incrementing number - but they also don't want that number to be out of sequence across those various things.

snipe avatar Jun 01 '24 06:06 snipe

@theukedge how do you propose we handle what I mentioned above?

snipe avatar Jun 01 '24 20:06 snipe

I'd say that allowing asset tag format templates would be best. With my asset tags, I prefer them random, rather than sequential, so I'd go for something like DRRR and when the tag is generated, it would choose 3 random characters (RRR) from the character set specified, test whether that tag exists, and if not, assign it (else, try again).

For people who want sequential numbering, I'd allow them to set that. I could see where people would either want it in sync with other tag formats, or not, so I'd allow them to pull in a specific number sequence into their tag template, or create a new one. For example, to keep them in sync, you might allow templates of US-0000 and EU-0000, where 0000 is the sequence, whose most recent value is stored in the database, which might then produce asset tags of:

  • US-1398
  • US-1399
  • EU-1400
  • US-1401
  • EU-1402

If people don't want the number sequence shared, you could track them separately in the database. So, you might have templates of US-0000 and EU-1111, where 0000 and 1111 are tracked separately, generating tags such as:

  • US-1398
  • EU-1921
  • EU-1922
  • US-1399
  • US-1400
  • EU-1923

theukedge avatar Jun 03 '24 20:06 theukedge

If people don't want the number sequence shared, you could track them separately in the database.

Sure, but where are we going to keep those increments? Do we have 20 new settings columns for the integer for every possible prefix? That seems kinda nuts. Not to mention the logic of which one to increment. And what happens when someone changes the prefix from {COUNTRY} to {CATEGORY}. This gets really messy really quickly, IMHO.

snipe avatar Apr 08 '25 06:04 snipe

My company is currently implementing a new ERP (SAP) and we have had this discussion in detail just as here. Seems the best practice according to SAP and our implementation partners is a prefix whether that be country, company, location what have you followed by sequential ID. Let’s say a device was deployed in company A, it will end up with the ID A001 and a second devices is deployed in company B, it will end up with B002. Now if device A001 moves to company be, its tag will simply be updated to B001. This maintains the unique ID, but reflects the new company. While I see the logic in wanting continuous independent sequences for each category, we realized uniqueness across the board is more valuable. Also, there’s only so much logic you can fit into an asset tag. And as things grow, there’s only so much creativity you can employ to these. So IMO, best solution is to simply allow a variable prefix but maintain asset tag uniqueness.

adsehgal avatar Sep 24 '25 13:09 adsehgal

My company is currently implementing a new ERP (SAP) and we have had this discussion in detail just as here. Seems the best practice according to SAP and our implementation partners is a prefix whether that be country, company, location what have you followed by sequential ID. Let’s say a device was deployed in company A, it will end up with the ID A001 and a second devices is deployed in company B, it will end up with B002. Now if device A001 moves to company be, its tag will simply be updated to B001. This maintains the unique ID, but reflects the new company. While I see the logic in wanting continuous independent sequences for each category, we realized uniqueness across the board is more valuable. Also, there’s only so much logic you can fit into an asset tag. And as things grow, there’s only so much creativity you can employ to these. So IMO, best solution is to simply allow a variable prefix but maintain asset tag uniqueness.

+1 for that. Before seeing this discussion, my main use case was to have a unique UID per device (as is currently the case). But I would like the prefix to be customizable. In the settings, we define an asset tag length + a prefix (as is currently the case). Example: prefix: INV- length: 5

Then we could define a prefix per category category A: CATA-

And if we add a device (let's imagine the first one): INV-CATA-00001 UID is 00001, but we have a global prefix + a category prefix. If we move it from category A to category B : INV-CATB-00001 maybe the printed label will only refer to 00001, to be always linked even if category change

It could be the same for category, locations, ...

I'm not sure if I've been clear. Thx !

guillaumearnx avatar Nov 19 '25 13:11 guillaumearnx