How to hide some panel.name when we create contact? (sugar 7.8)

Hi,
I try to hide some panel.name form not admin users like this
({     extendsFrom: 'CreateView',
 
       initialize: function (options) {
          app.view.invokeParent(this, {type: 'view', name: 'create', method: 'initialize', args:[options]});
          var isAdmin = app.user.get('type') == 'admin';            
          if (!isAdmin) {
             this.meta.panels = _.filter(this.meta.panels, function (panel) {                    
             if (!(panel.name == "pane-recycle-styler" || panel.name == "panel_hidden_recycles" || panel.name == "panel_hidden_recycle_assign" || panel.name == "panel_hidden_activity")) return true;
             return false;
                })
           }    
       },
})

but I have more issue, Please HELP!
I try to put this  into record.js in custom/modules/Contacts/clients/base/views/record/record.js
may be need  another file?

  • Hi Nick Gamora 

    Instead of customizing the js view you can just copy the file custom/modules/Contacts/clients/base/views/record/record.php to custom/modules/Contacts/clients/base/views/create/create.php and modify what you really need to, like:

    • replace the view name 'record' by 'create' at $viewdefs['Contacts']['view']['record']
    • remove the panel which should not be rendered on creating a Contact

    After saving the new file you just need to run Quick Repair and Rebuild.

    A side effect on doing that is: by customizing the view record on Studio the changes will no apply on view create, so you will need to do the changes by hand.

    Another possibility is to create a SetPanelVisibility on field date_entered, which may render such panel only if date_entered is set. This way the view remains the same one.

    Kind regards

    André Lopes
    Lampada Global
    Skype: andre.lampada