ConvertLeads Custom JavaScript Loading

Two questions,

  1. Is there a way to get dependency dropdowns to work in the Conver Leads convertdefs.php file?
    I did not know how to get this done and everything I tried failed.

So that leads to question #2.
2. How to add custom JavaScript files to load in the custom/modules/Leads/metadata/convertdefs.php?

I tried several ways to get it to work but nothing loaded. I finally copied the modules/Lead/views/view.convertlead.php over to the custom folder and added this at the top of the display() method:

    // Cannot seam to get JavaScript to load up using the medata/convertdefs.php file 
    // So using this as a work around.
    echo ('<script type="text/javascript">
    // Work around to load up custom JS
    var sc = document.createElement("script");
      sc.setAttribute("src", "custom/modules/Leads/js/convert_leads.js");
      sc.setAttribute("type", "text/javascript");

This does what I need it to do and the JavaScript handles the drop-down dependency.


That is quite an alright way to do it, except that you don’t have to copy the whole file, you could just extend the view class and override a single method.

Also, you might prefer to put your JS into one of the tpl files referenced there, and then you would just have a minor adaptation in the PHP code, changin this:


to something like this


and putting your edited tpl under custom dir