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:
Hello ,
I want to include some custom JS/CSS to all pages of suitecrm, but i am not sure what is the best practice to do so.
i searched the forum and found the best way is to include the Files at the metadefs for the module’s view.
But this doesn’t help me since i want to include the files at all suitecrm pages.
i thought about putting the files at custom/theme/SuiteP and override the footer.tpl or head.tpl for example.
But, i am not sure if this will be upgrade safe since i am overriding …
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