Custom Javascript doesn't work

Goodmorning,
I created a custom js file into /custom/include/js folder that print into console a string.
then in the admin panel, made quick build and repair operation, but I can’t see my log.
Maybe I forgot something operation to do.
I need to include this js into all crm pages (also login page) .
Where I must include this file?

Thank you,
B.

Hi,
it depends on the use case how to do it. Let’s assume you want to inject a js file to the accounts EditView:

First, edit custom/modules/Accounts/metadata/editviewdefs.php and look for:

array (
	0 => 
        array (
          'file' => 'modules/Accounts/Account.js',
        ),
	),

add a second file bucket:

array (
	0 => 
        array (
          'file' => 'modules/Accounts/Account.js',
          'file' => 'modules/Accounts/custom.js',
        ),
	),

now, add file modules/Accounts/custom.js. It could contain something like:

$( document ).ready(function() {
    console.log("hello world");
});
2 Likes

Thank you for your reply,
I need to inject the js, into all possible pages.
Have I made the solution that you give me, for all pages?
Thank you,
B.

Hi,
maybe this post is of any help:

Thank you, you mean that in custom/include/js is not the correct place?
B.

Thank you so much, it works!
My previous solution doesn’t work cause my custom file name isn’t style.js.

B.

nice, glad you were successful :+1: