Issue after uninstalling the extension when its field was changed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paulina
    Member
    • Feb 2022
    • 41

    Issue after uninstalling the extension when its field was changed

    Hello,

    Error receiving progress:
    1. I installed an extension that creates an enum type field "customerType" in the Case entity with the options "Person" and "Company".
    2. Placed that field in Case detail layout.
    3. Created Case record with "customerType" option "Company".
    4. I added another option to this field via Entity Manager called "another option".
    5. Later I decided to uninstall this extension.
    6. After uninstall field was gone but in Case entity I get Error 500.

    Logs says:
    Code:
    [2024-12-06 08:52:17] CRITICAL: (0) Field 'customerType' has no type. :: GET /Case :: application\Espo\ORM\Defs\FieldDefs.php(74)
    When I added another option via Entity Manager, this change appeared in the custom part of the system when my extension was created via the module. So I think this is what caused the error. I know that all changes made through Entity Manager appear in the custom section, but this becomes a mismatch when you want to uninstall an extension whose field was changed through Entity Manager.

    Espo ver: 8.4.2
    PHP ver: 8.2.4
    Database: MariaDB 5.2.1
    Attached test extension .zip


    customerType field json which was installed:
    Code:
    {
        "fields": {
            "customerType": {
                "type": "enum",
                "options": [
                    "Person",
                    "Company"
                ],
                "style": {
                    "Person": null,
                    "Company": null
                },
                "default": "Company",
                "maxLength": 100,
                "isCustom": true,
                "required": true
            }
        }
    }​
    customerType field json after adding the option /custom/Espo/Custom/Resources/metadata/entityDefs/Case.json:
    Code:
    {
        "fields": {
            "customerType": {
                "options": [
                    "Person",
                    "Company",
                    "another option"
                ],
                "style": {
                    "Person": null,
                    "Company": null,
                    "another option": null
                }
            }
        }
    }​
    I removed the error by deleting "customerType" field part in /custom/Espo/Custom/Resources/metadata/entityDefs/Case.json.
    Attached Files
    Last edited by Paulina; 12-06-2024, 09:24 AM.
  • yuri
    Member
    • Mar 2014
    • 8438

    #2
    Hi,

    I will try to find a solution when get a chance. This is not a trivial problem.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8438

      #3
      The fix: https://github.com/espocrm/espocrm/c...bc96ecac4fd5ea

      Fields and links without type are filtered out when metadata is being built.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...