- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2023 05:14 AM
The premise is using a custom table that inherits the task.
The requirement is that we would like to have a unique number automatically populated in a field separate from the record number in the custom table that is counted for each record created.
Is it possible to achieve this requirement through scripting or other means?
As an example, we would like to have the following sequence of numbers.
*"ABC" and "CD" do not vary.
Example: ABC00000CD
Thank you in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2023 01:54 AM
Hi,
This is something you would normally do on a table with a column that has autonumbering on it. You can look in the ui by typing (Number Maintenance) to see the coumns for each table. A table can have just one of those columns, so that works for a new custom table only. And as a sidenote, those auto number fields always have a prefix (a few characters) followed by the number. In your case you still want to add two characters after the number. I would recommend to reconsider that as nothing in ServiceNow has that kind of structure, but that is up to you.
Simple solution is: a "before insert" business rule where you just write some script to create the string with whatever you like in it based on anything you like and just write that to the field before the insert takes place.
If you think my answer put you in the right direction or you appreciated my effort, please mark the response as Helpful or mark my response as Correct.
Thanks in advance! Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2023 01:54 AM
Hi,
This is something you would normally do on a table with a column that has autonumbering on it. You can look in the ui by typing (Number Maintenance) to see the coumns for each table. A table can have just one of those columns, so that works for a new custom table only. And as a sidenote, those auto number fields always have a prefix (a few characters) followed by the number. In your case you still want to add two characters after the number. I would recommend to reconsider that as nothing in ServiceNow has that kind of structure, but that is up to you.
Simple solution is: a "before insert" business rule where you just write some script to create the string with whatever you like in it based on anything you like and just write that to the field before the insert takes place.
If you think my answer put you in the right direction or you appreciated my effort, please mark the response as Helpful or mark my response as Correct.
Thanks in advance! Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 03:57 AM
Sorry for the late reply.
We were able to achieve our requirements by utilizing business rules.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 12:13 AM
Hey @N_Y_1014
Can you please share some sample script?
In my case, I have to something like below: CC-PPP-auto number in sequence.
For example: CC-PPP-001, 002, 003...
Thank you