This code update will allow the autonumber solution to pull numbers from a pre-generated list of numbers, instead of generating on the fly.
Description of functionality:
At config time: SysAdmin configures a number to use PreGenerated numbers. Then they must manually create the numbers, or import from an excel list, or insert via API
At runtime: the GetNextNumber plugin will check if an autonumber is configured to use a list.
a) If yes: Then it will filter just the Active numbers in the list, and sort by the ordinal, and take the first number in the list. Once a number is used, it is deactivated. If there are no available numbers, then an error is thrown (sys admin is responsible for ensuring that numbers never run out).
b) If no: Then normal number generation is used
You will need to update the base solution:
Update cel_autonumber entity:
Add new field: "cel_IsPreGenerated" (boolean) default = false. This field needs to appear on the AutoNumber config form.
Create new entity "cel_generatednumber":
"cel_ParentAutonumberId" (lookup). Relationship to autonumber config record. (required field)
"cel_ordinal" (whole number). Controls the sort order (usage order) of the numbers. (recommended field) - if it is left blank then all numbers will be selected randomly. Should limit to positive integers only
"cel_number" (single line of text)(required). The number that will be used on records.
This new entity needs to be displayed as a subgrid on the AutoNumber config form.
Not implemented in this pull request, but potential additions:
On the AutoNumber config form, if PreGenerated is set to yes, then the inapplicable fields should be hidden and the subgrid should be shown. If PreGenerated is set to no, then the subgrid should be hidden.
May want to implement additional validation at config time
Implement some way to make it easy for admins to pre-generate numbers.
We may want to consider the situation when the pre-generated number might be a longer length than the field it's attempting to be inserted into...
This code update will allow the autonumber solution to pull numbers from a pre-generated list of numbers, instead of generating on the fly.
Description of functionality:
a) If yes: Then it will filter just the Active numbers in the list, and sort by the ordinal, and take the first number in the list. Once a number is used, it is deactivated. If there are no available numbers, then an error is thrown (sys admin is responsible for ensuring that numbers never run out). b) If no: Then normal number generation is used
You will need to update the base solution: Update cel_autonumber entity:
Create new entity "cel_generatednumber":
This new entity needs to be displayed as a subgrid on the AutoNumber config form.
Not implemented in this pull request, but potential additions: