Get current module and view javascript

Is there a javascript function to get current action/view (QuickCreate/Create/Edit/Record) and module (i.e "Meetings"). Something like SUGAR.App.getCurrentView() or SUGAR.App.getCurrentACL() ??

I am trying to filter what modules show up as options for the parent relate field type, it currently shows every module, even the ones we don't use, currently I am looking at modifying the _filterModuleList: function(modules) under clients/base/fields/parent/parent.js as it looks like it only filters by ACL access, and you cannot for some reason change it in studio (despite having a dropdown editor?) and i would like it to filter based off different arrays depending on current module

Any help would be appreciated, I'm growing quite frustrated

  • You can control what modules appear in the Parent Relate dropdown from Dropdown Editor, look for:

    parent_type_display

    For US English this will update: 

    custom/Extension/application/Ext/Language/en_us.sugar_parent_type_display.php

    If you are making changes to the dropdown but they are not being saved, then you probably have an issue with permissions on your file system.

     

    My panacea on Linux is running this from sugar root, it will update recursively all files and dirs:

    sudo chown -R  apache:apache *

    sudo find . -type d -exec chmod 775 {} \;

    sudo find . -type f -exec chmod 664 {} \;

     

    HTH

    FrancescaS

  • Thank you so much! Although I still need to figure out how to make one specifically for each module (different dropdown for meetings, opportunities, quotes, etc...) maybe if I expose the drop down variable by modifying the DynamicField and SugarField files?

  • You can remove certain values from within the Create/Record View controller.

    For example, in my Leads module, when users create a new record I want to hide "legacy" values, which are noted with  the word "legacy" added to the dropdown's display value.

    E.g.

    ({
       extendsFrom: 'CreateView',

       initialize: function(options){
          this._super('initialize', [options]);
          this.hideLegacyValues();
       },
    hideLegacyValues: function(){
         // hide legacy items from academic_subtype
         var academic_subtype_list = app.lang.getAppListStrings('academic_subtype_list_DD');//get all the values from app list strings
         //loop through the values
         Object.keys(academic_subtype_list).forEach(function(key) {
            //if the value has legacy in it then delete that from the list being displayed
            var check = academic_subtype_list[key].match(/legacy/);
            if(academic_subtype_list[key].match(/legacy/)){
               delete academic_subtype_list[key];
            }
         });
         //update the dropdown options with just those that remain
         this.model.fields['academic_subtype_c'].options = academic_subtype_list;
       },
    })

    In your case, you will repeat the code in the RecordView controller.

    I only do this in the Create View because I still want users to see legacy values in Record View. Then in Record View if they save with a legacy value in the dropdown I ask them to confirm that they want to keep it with an alert.

    FrancescaS