Announcement

Collapse
No announcement yet.

Number auto-increment is not working for my customized extension.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Number auto-increment is not working for my customized extension.

    Hi,

    Good day!

    I have encountered an issue where the "Number" field is not incrementing after i install my own extension with an Entity with "Number" field.

    under entityDefs > {entity}.json

    Code:
    {
    "fields": {
    ...
    "numberID": {
    "type": "number",
    "len": 36,
    "notNull": false,
    "unique": false,
    "nextNumber": 1,
    "padLength": 6,
    "prefix": "PRE-",
    "tooltip": false,
    "isCustom": true
    },
    ...
    }
    }

    After installing the extension, this is not working. (I copied the code, generated from Custom when I try to test in a seperate environment and push it to my extension)

    But, it works after I update something on the field through "Entity Manager" like the "padLength" this change has been pushed to the Custom, and after that it works.

    To replicate the issue:

    1. Create extension with entity and has field "Number (auto-increment)"
    2. Upload extension and install.
    3. Create data for entity and check if it would increment.
    4. Value is none. Not incremented.
    5. Go to Entity Manager, and update the field (ex. padLength) and save.
    6. Create data again for entity and check if it would increment.
    7. Value is now PRE-000001. Incremented.

  • #2
    Hi,

    I think you need to add AfterInstall and AfterUninstall scripts to your extension:

    Check what code is executed when you add number field via Entity Manager:
    EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.

    Comment


    • #3
      Thanks! I'll check how to do this.

      Comment

      Working...
      X