SUGARCRM: INCLUDE JAVASCRIPT FILE ON LISTVIEW

How to call JavaScript on List View?

It will be done by one step only! Lets do this,

Step 1 : Steps are as below, As it is SugarCRM’s module, copy modules/<desired_module>/views/view.list.php to custom/modules/ <desired_module>/views/view.list.php or edit if it already exists at custom/modules/<desired_module>/views/view.list.php

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/MVC/View/views/view.list.php');
class {<desired_module>}ViewList extends ViewList
{
    function __construct()
    {
        parent::__construct();
    }
    function preDisplay()
    {
        echo '<script type="text/javascript" src="{INCLUDE_FILE_PATH}"></script>';
        parent::preDisplay();
    }
}
?>

Step 2 : Now go to Admin > Repair > Quick Repair and Rebuild.

Note :

Here, <desired_module> means the module name you see in the URL, for example, Contacts, Leads, etc.
Also INCLUDE_FILE_PATH means your JavaScript file path.

Hope you find this blog post helpful.

Feel free to add comments and queries, that helps us to improve the quality of posts.

You can contact us at info@infotechbuddies.com

Thank you.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *