Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Auto Increment Numerical Value in Catalog Item Variable "Project number"

prasad8
Giga Expert

Hi,

My requirement :

I have created one new variable in catalog item "Project Number", for this project number variable i need auto numbering functionality like incident number.

 

find_real_file.png

Please help me on this requirement.

 

 

Thanks,

 

 

9 REPLIES 9

Alessandro Alme
Tera Guru

Hi @Alessandro Almeida ,

 

I have create auto number in catalog variable not in table fields

Please help on this

 

Thanks,

Prasad.

Saurav11
Kilo Patron

Hello, 

You can give javascript:getNextObjNumber(); in default value of variable for auto numbering in service catalog form .find_real_file.pngfind_real_file.png

Please mark answer correct/helpful based on impact.

Ankur Swami
Tera Guru

Hi,

Actually we don't have any OOTB way for the catalog variables.

You can build a custom solution like i explained below:

 

1. Create a system property "add_auto_inc"

Type = Integer

Value = 10001 or what ever you want to give in Integer.

2. Create a onSubmit catalog client script and in that script call a script include Where you will be updating the system property value by +1

Ex: 10001 + 1 which is 10002

3. In you project ID variable run a javascript in the default value:

javascript: 'PRJ'+gs.getProperty('add_auto_inc');

 

This way you can achieve your requirement.

If my logic helps you then please mark my answer correct.

 

Thanks,

Ankur