How do you generate a new ticket number only on save?? Basically prevent unused numbers...

joed_souza
Kilo Explorer

It appears like by default, if you click on New Incident or New Problem or New Change, a number (SYS_ID) is automatically generated even before you save the ticket so in case you do not need to save it, that number is gone forever.

How would you prevent that from happening - meaning assign a new number (SYS_ID) for a ticket only if you save or submit it?

Joe

11 REPLIES 11

So it is not possible to control that at a form (Incident, Problem) level?


There is a Global Business Rule named getNextObjNumberPadded.   This is the code that gets called when you first open a form and it populates the number.



You can go to the dictionary entry for the number column on the task table, and see the default value is calling this script.



This is also where it references that property.   You could customize this Business Rule to look at the table and make that call.


Is there any way to reclaim unused records? I only just recently enabled "Assign a task number only upon insert (prevents unused numbers).", and would like to do some sort of reclaim of these "blank" records.


You would need to create your own custom function that would be a wrapper around the getNextObjNumberPadded.   You would also need a way to get a list of all of the missed numbers, and make sure that as you handed them out, two requests coming in at the same time did not get the same number.   It would be a complex undertaking just to have every possible number used.


Not to mention, you'd have new tasks with numbers out of sequence based on creation date.



I don't know that the inconsistency would be worth it... Another option would be to change the table's numbering prefix being used and restart the numbering now that you have your setting in place.   But again, you're talking about a change that some people might not be thrilled about... however, at least the numbers would be ordered consistently when compared to creation date.




-Brian