how to change the prefix the number field based on location selected

RiyazAhamed
Tera Contributor

Hi All,

 

I have requirement to populate the number field with customized prefix. I know it can be changed in Number Maintenance table. But the prefix will be dynamic based on the location of the user/location selected.

Example: If I select location as India the number field should be IND0001001... If the location selected is America then the prefix should be USA0001001... the number should be incremented based on the location.

 

India - Location IND0001001,IND0001002,IND0001003....

US - Location USA0001001,IND0001002,IND0001003....

 

Number sequence will continue location wise.

If first record is created for India number field will be like IND0001001 second record is from US then it should be USA0001001... like wise it should for all location.

 

Thanks

Riyaz

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @RiyazAhamed ,

 There is no OOTB way to achieve it, even with the number maintenance or from the tables's controls as well.

You have to go with a customized approch using a BR maybe.

Refer to this thread which is talking about domain specific, in your case try with location: 

https://www.servicenow.com/community/developer-forum/how-to-add-a-prefix-in-incident-number-field-ac...

 

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi @RiyazAhamed ,

 There is no OOTB way to achieve it, even with the number maintenance or from the tables's controls as well.

You have to go with a customized approch using a BR maybe.

Refer to this thread which is talking about domain specific, in your case try with location: 

https://www.servicenow.com/community/developer-forum/how-to-add-a-prefix-in-incident-number-field-ac...

 

RaghavSh
Kilo Patron

You will have to disable Number Maintenance on your table and handle this through custom BRs.

This is not recommended and may not be easy to achieve as number maintenance is automatically handled by servicenow code. You will need to maintain your own counter and that too for different location and check the previously inserted record through before insert BR and set the number by incrementing 1.

 


Raghav
MVP 2023