Automatically Generating Unique CI ID's

Not applicable

I'd like to have a mandatory unique ID for each CI, but Service-Now seems to allow duplicates of both the name and the asset tag. Additionally I'd like for that Unique ID to be automatically entered by Service-Now when a CI is created. The name should be meaningful and so derived from the CI Class and what is entered into some of the CI attributes.

For example say it was the 100th Linux Server we'd entered and when we created it we filled in a field to say it was only used by the Finance department. An ID would be created for that CI called LNX-FIN-100. The next Linux Server for the Finance department would be called LNX-FIN-101. I haven't yet thought through the exact naming convention, so I may also want to include other things e.g. the domain which entered it, though obviously they need to be things that won't change during the life of the CI.

Is this type of thing doable? And if so how would I go about it. Any suggestiong will be gratefully received.

Kind Regards
Helen

9 REPLIES 9

Not applicable

If you want to enforce uniqueness on a column you need to go into the dictionary for that column entry and click the "unique" checkbox next to it.

The unique checkbox isn't on the dictionary form by default, so you'll need to personalize the dictionary form to add it.

A couple of notes:

When you click this checkbox to on, the column in question can't have duplicate values in it (nulls are ok). If it does, you'll get an error message indicating that the attempt to create a unique index failed.

Uniqueness is actually enforced at the DB layer in this case, so if you try to create two things with the same value, your second insert will fail with a db layer error (unique constraint violated).


Not applicable

OK. So I can enforce uniqueness on a column, and I can make it mandatory so it doesn't contain nulls.

But can I put any script anywhere to say when a new CI is created that the field is populate with the next number in a sequence determined like in the example above eg. LNX-FIN-100


Not applicable

Sure, you can do it with default value on that field, or you can use an on insert business rule (depending on when you want to number to appear).

You'll have to write the script to generate the correct sequence number of course (based on your busines logic).


Not applicable

Thanks for this, we'll have a go at scripting a business rule.