Make a new field auto numbered

sayalimore
Kilo Expert

Is it possible to have two fields in one table be auto numbered?

On Incident table, there is a number field which is auto numbered already.

Now I have created one more field (on same table)which also needs to be auto numbered on every update happened on the incident form.

Any help will be appreciated 🙂

15 REPLIES 15

Sharique Azim
Mega Sage

Hi Sayali,



I am not sure if you can put two entries for same table.



So maybe you use after insert br to find the last updated custom number and increment it by 1.




script could be   something like




var gr= new GlideRecord('incident'); //say my table is incident..


gr.orderByDesc('number');


gr.query();


if(gr.next()){


var num= gr.field_name;


var str= num.substring(3); //say the field number is   NUM0000123, so ill delete NUM


var str_i = parseInt(str);


str_i++;


current.field_name="NUM"+str_i;



}


Hi Shariq,


The above script does   not satisfy my requirement


hi, but the op of this is NUM3 how can we get the full NUM0000123 +1?

Goutham sai
Tera Expert

Please try display BR and write below script in advanced condition.

 

current.field_name = getNextObjNumberPadded();

 

Thanks,

It worked like a charm