SuiteCRM 8 - Add javascript to a module


I need the following operation:
When the contact is saved with the “Customer” type, the following fields must be filled in:

  • First name
  • First name
  • Email address
  • Date of birth

Otherwise, an error is returned to indicate that the save could not take place.

So I think I need to add some custom javascript to check the fields before sending the form and to display a custom error message.

I’ve tried adding this code to custom/modules/Contacts/metadata/detailviewdefs.php :

                includes' => array(
                        file' => 'modules/Contacts/ContactDetail.js'

But when I do a console.log nothing is displayed.

Do you have a solution for SuiteCRM 8 please?


I have successfully installed SuiteCRM 8.3.0 instance and created custom fields on the Case module. I’ve tried adding a custom JS “on change” function to a drop-down field in the view.edit.php file. I have also included the case.js file in the editviewdefs.php file. But still, it is not working.

In SuiteCRM 7 custom js is working in the view.edit.php file but not working in SuiteCRM 8.3.0

Please suggest how and where to add javascript/jquery logic to the custom field on the edit view and detail view of the module in SuiteCRM 8.3.0