Unique Number Generator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2012 10:04 AM
Hi All,
I want to generate a unique number(prefix+number) for asset tag field in cmdb_ci table.This is achievable using number maintenance. But as I am implementing it in MSP environment, I cant use the same.Because it will generate a unique prefix for a particular asset across all domains.
To achieve this I am implementing a whole new application similar to number maintenance ,but domain separated also. I am not sure about the logic running behind it. How it is appending the prefix to number and how the counter is generating.
Please help me in getting the logic to use in my custom application.
Any scripting used to achieve this would be of great help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2012 10:53 PM
Check this out. From a scripting stand point, this may or may not help:
http://www.servicenowguru.com/scripting/numbering-existing-records/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2012 12:43 AM
Hi Matt,
Thanks for your answer.I made an entry for every asset in my number maintenance module and call these entries using the below mentioned business rule :
current.asset_tag = new NumberManager(current.sys_meta.name).getNextObjNumberPadded();
current.update();
This is working fine. I want to ask what if some customer require asset tagging and other don't, in the format I entered in number maintenance.
For this I should make the number maintenance module domain separated ?Is this achievable??
(Eg: For customer A, asset tag for cmdb_ci_computer should be CMP00001 and for customer B it should be Computer00001)
Please help me in getting the desired outcome.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2012 02:43 PM
I would approach this via a new table/module so that you don't alter the OOB number maintenance table. Using a Script Include define a function to evaluate the statements for determining the correct prefix. I can say that I have not seen this done before.