Search code examples
hidesugarcrmdashlet

Hide Product Catalog standard dashlet for all users in Sugarcrm


How can i hide a standard dashlet named "Product Catalog" from the list which gets displayed in the drawer named "Add a Sugar Dashlet". "Add a Sugar Dashlet" drawer gets displayed when user tries to add a dashlet in any dashbaord in Sugarcrm. Hiding should be done in an upgrade safe way.

Note: I am using Sugarcrm Ver 8.0.0 PRO


Solution

  • One way to accomplish this is by creating a custom override of the DashletselectView where you filter out the Dashlet in question. The code below does so by overriding an internal function of the view, post-processing its results.

    custom/clients/base/views/dashletselect/dashletselect.js

    ({
        extendsFrom: "DashletselectView",
    
        _getDashlets: function() {
            var dashlets = this._super("_getDashlets", arguments);
            return _.filter(dashlets, function (d) { return d.type !== "product-catalog-dashlet"; });
        },
    })
    

    Then run Quick Repair & Rebuild so that Sugar detects the presence of the custom file and loads it.