Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

Intermittent gap in custom Number Maintenance sequence on alm_license

pavan Punna
Tera Contributor

Hi Community,

I configured Number Maintenance for Software Entitlement [alm_license]:

  • Prefix: SWL
  • Digits: 8
  • Field: u_number
  • Default value: javascript:global.getNextObjNumberPadded();

A Before Insert/Update Business Rule copies u_number to asset_tag.

In TEST, I’m intermittently seeing a skipped number, for example:

SWL00008915
SWL00008917
There is no record for SWL00008916 in asset_tag, u_number, or deleted records. I’m certain the New form was not cancelled and there were no validation or insert errors. I followed the exact same creation process when the gap occurred and when subsequent records were generated continuously.
 
 
 
 
1 REPLY 1

vijaydodla
Giga Guru

Hi @pavan Punna ,

Skipped numbers are expected behavior and are almost always caused by how the sys_number_counter allocates numbers. Because your u_number field uses javascript:global.getNextObjNumberPadded(); as its default value, the number is fetched and permanently consumed the exact moment a new record is initialized. Even if you did not cancel a form or experience an error, the missing number (SWL00008916) was consumed by the system and cannot be rolled back.

 

To strictly enforce sequential numbering without gaps on your custom configuration, you must change when the number is generated:

  1. Remove the Default Value: Clear javascript:global.getNextObjNumberPadded(); from the Dictionary entry's Default Value tab for u_number. This stops the number from generating when the form opens.
  2. Update Your Business Rule: Move the number generation logic to your existing Before Insert Business Rule.
    javascript
     
    Copy Code
    // Inside your Before Insert Business Rule
    if (current.u_number.nil()) {
        current.u_number = global.getNextObjNumberPadded();
    }
    // Continue with your existing logic to copy to asset_tag
    current.asset_tag = current.u_number;

By doing this, the number is only pulled from the counter at the exact moment the record is successfully committed to the database, eliminating gaps caused by form loads or abandoned sessions. (Note: The u_number field will appear empty to the user while filling out the "New" form).

 

Please mark the Solution Accepted if the above helps. This will help others.

 

Thank you

Vijay