Error in custom module

Hello everyone,

I have a rather strange problem with SuiteCRM 8, which I believe is related to the cache. I create a module using the Module Builder, and before deploying the package, any edits to the editview metadata are applied correctly. However, when I go back to the Module Builder and modify the edit layout, it applies the changes and saves them in:

public/legacy/custom/modulebuilder/packages/PACKAGE_NAME/modules/MODULE_NAME/metadata/editviewdefs.php

When I deploy again, it moves them to:

public/legacy/modules/KEY_PACKAGE_MODULE_NAME/metadata/editviewdefs.php

In theory, it moves the files correctly. Then I do a quick repair to clear the cache, but when I go to the editview, it now shows the default view of the module. I don’t have anything created in the path:

public/legacy/modules/KEY_PACKAGE_MODULE_NAME

since the changes are made from the Module Builder, not from Studio. I also deleted the cache folder directly, but nothing changes.

In the console, I get the following error: node_modules_angular…1a513b7cb4915e.js:1 ERROR TypeError: Cannot read properties of undefined (reading 'panelDefault'). However, this error appears in all custom modules, and I also get it in the first deploy, which works fine, so I don’t think it’s related to the current issue. Additionally, the SuiteCRM log doesn’t show anything relevant.

I appreciate any help, thank you very much.

I have suitecrm set up in docker with the bitnami image: https://hub.docker.com/r/bitnami/suitecrm
and I created a local volume which points to the suitecrm project
SuiteCRM: 8.6.2
PHP: 8.1.29
MariaBD: 11.4.3

In SuiteCRM 8

The modules are by default running modern( instead of SuiteCRM 7 /classic view). In that case the only metadata being used is the detailviewdefs.php

Basically for the suite8 record views detailview and editview are the same.

Hi Abuzarfaris
thank you for your response. As far as I understand, when creating a custom module from the Module Builder, SuiteCRM still follows the legacy structure, so it should behave the same as in version 7, where the Detail and Edit views are separate. Is that correct?

Search these forums for legacy.module_routing to learn how to change the mode of specific modules.

config/services/module/module_routing.yaml

Check if you have that custom module there and its setting.

A lot of things in the studio/module builder are from suite7 so even though it is showing you separate layouts for edit and detail views. By default in SuiteCRM 8 only the detailview is being used.

To change this you need to switch the module routing for you module to classic

Here is a very helpful video on how to override the routing

    accounts:
      index: true // true means suite 8 view
      list: true
      record: false // false means classic view
1 Like

Hi everyone,
Correct, by default it adds the native ones, but following the adjustment that was recommended, I was able to change them. Thank you very much.

Mark the reply as answer :white_check_mark: which solved your problem. It will help others in the future.

Hi,

The following points can be followed to resolve the issue:

  1. Docker Cache:

Ensure that your Docker container is properly clearing the cache. Sometimes, changes don’t reflect due to caching at the Docker level. You might want to try restarting the container after making changes

  1. SuiteCRM Cache:

After deploying your module, make sure to clear the SuiteCRM cache thoroughly. You can do this by:
Running the Quick Repair and Rebuild from the Admin panel.
Deleting the contents of the cache folder directly, but not the folder itself.

  1. Check Deployment Path:

Verify that the deployment path is correct. Since you’re using a Docker setup, ensure that the volumes are correctly mapped, and that changes in the Module Builder are reflected in the correct path in your local volume.
Check for any issues in the deployment process that may cause the files to be moved incorrectly.

  1. Check Metadata files:

After deploying, manually check the contents of the public/legacy/modules/KEY_PACKAGE_MODULE_NAME/metadata/editviewdefs.php file. Ensure that it contains the expected definitions. If it’s empty or not as expected, the deployment may not be functioning correctly.

  1. Check the permissions inside the docker container.