Two number maintenance for one single table/form in servicenow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 10:08 AM - edited 04-17-2024 10:09 AM
Is there any possibility to create two number maintenance auto numbering for a single table or form.
I created one number maintenance like DNC-00001, I want this create one more like D-0001.
If not possible with number main any other suggestions or code that any one can share that will be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 02:03 PM
Hi VIkramM1,
If the new number is simply an extraction from the existing one, you can add that field onto your record and then create a before insert business rule. In it you just need a statement something like this:
current.otherNumber = <prefix> + current.number.substring(x,y);
where <prefix is D- or whatever and x,y are start and length.
Make sure that you don't include an update() statement in any before insert rule or you could end up in an endless loop.
If you need to use some other sequential mechanism, the simplest thing is to create a property and start it with zero. Then your before insert rule can look up the value, increment it for attaching to the alternative number field and also update the property.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 05:20 AM
Hi @VikramM1
Any reason to have 2 different numbers for the same form? It is not a recommended approach.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 05:32 AM
Hi @VikramM1 ,
Yes ! but techenically not good unless you can manage it well !
The way to do is by creating 2 diffrent numbering field on 1 table with Prex as DNC-00001 and D-0001 instead of 1 field. (the possible solution is by using 2 field not by 1 field)
Based on your conditon you can set the UI POLICY visiblity of each field. I hope this helps...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....