How i can generate asset tag and serial number automatically in alm_asset table?

Community Alums
Not applicable

Hi All,

I am creating records dynamically in alm_asset table via run script activity in workflow. Whenever a record is created i need to set unique value to both "Asset Tag" field and "Serial Number" field. Can anyone help how can we achieve this without number maintenance?

 

Regards,

Sirraj

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi Abhishek,

Thank you for the reply and sorry for the late response.

I have achieved this without number maintenance. I have stored a counter value in property and whenever i am inserting a record i have called that property to set numbering for the asset field.

-Sirraj

View solution in original post

8 REPLIES 8

Community Alums
Not applicable

Hi Sanjeev,

Thank you for taking time and replying to my post. This is not am looking for, i need to create records with auto numbering the asset tag field.

Regards,

Sirraj

AbhishekGardade
Giga Sage

Hello Siraj,

Administrators can manage record numbering by navigating to System Definition > Number Maintenance. The current number format for a table, including the prefix (such as INC for incidents or CHG for changes), is stored in a record on the Number [sys_number] table.

Reference : https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/field-administrat...

There is entry available for asset table in number maintance table, if not create for it.

Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies

Thank you,
Abhishek Gardade

You need to create entry for Asset table :

find_real_file.png

And in script you need to add below line for auto numbering:

var gr = new GlideRecord('alm_asset');

gr.initialize();

gr.asset_tag = new NumberManager(gr.sys_meta.name).getNextObjNumberPadded();

gr.insert();

OR Option 2:

find_real_file.png

Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies

 

Thank you,
Abhishek Gardade