Detail View not recognizing Includes or Javascript in metadata file

Hi, I’ve been working on trying to get javascript running on the detail view of my custom module. The script works exactly as it should in edit view. But when creating my includes and javascript tag in detailviewdefs nothing seems to happen. Even when I boil it down to:

'javascript' => '<script>console.log("hi");</script>',

in my detailviewdefs.php. I’m running in developer mode but even then I’ve tried a QR&R with no luck. My includes array and javascript entries are exactly the same so this has been a frustrating task because the documentation shows the implementation for detailview javascript the same as editview.

'templateMeta' => 
    array (	
	  'includes' => array(
		0 => array(
			'file' => 'custom/modules/Rooms_Rooms/js/roomsDetail.js',
	  'javascript' => '<script>console.log('hi');</script>',

The closing parenthesis is left out, but other than the different filename and the test console.log the metadata files are exactly the same. I’ve tested changed the regular metadata files as well without anything happening either. Thanks

still seems like ‘javascript’ tag doesn’t do anything in detail view, I fixed this by creating this function inside my javascript file as an entry:

SUGAR.util.doWhen("typeof $ != 'undefined'", function(){
     //starts here
1 Like

after adding includes in metadata file you must make admin-> Repair -> Quick Repair and Rebuild.
After this you must clear cache in brouser.

I have developer mode on, so that’s not needed