Dynamic auto-numbering on a custom field?

Farah5
Tera Contributor

I have a custom field that has auto-numbering set up. However the prefix for that field needs to change depending on a "Type" field value. 

I don't want to set the default value, because the number field should be blank until the Type field value is set. If the Type field value changes later on, the number field should also adjust the prefix. 

Does anyone have any suggestions on how to do this? 

1 ACCEPTED SOLUTION

Update your code like below

 

current.u_risk_identifier = getNextObjNumberPadded();

 

Regards,

Sachin

View solution in original post

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

You can configure a business rule on your custom table and based on type fielf value, you can use below API to do auto numbering.

 

var a = return new global.NumberManager().getNextObjNumberPadded();

 

Regards,

Sachin

Is the return statement necessary? My business rule script is giving me an unexpected return statement error. I tried this instead but I'm getting a blank value: 

 

current.u_risk_identifier = new NumberManager().getNextObjNumberPadded();

Update your code like below

 

current.u_risk_identifier = getNextObjNumberPadded();

 

Regards,

Sachin

Perfect this works! Thank you