Dropdown Values

Can dropdown values be hidden in dropdown but available for reporting

  • Hi  ,

    This functionality does not currently exist in Sugar. I thought your use case might be achievable by making the field dependent on a parent dropdown. With that setup, you configure which values are displayed based on the parent dropdown's value. However, if the value a record was previously saved with is no longer visible due to the parent dropdown configuration, it will just be deleted on the next save event. 


  • So once the value is deleted from the Dropdown (via Dropdown editor for example) then this value is no longer visible even on records that it was previously saved on - is that correct?

  • We came up with a scheme whereby we mark some values as legacy and do not allow users to select those when creating a new record.

    To do this we add "(legacy)" to the Label of those dropdown values then we hide the them in create.js

      extendsFrom: 'CreateView',
      initialize: function (options) {
        this._super('initialize', [options]);
      hideLegacyValues: function(){
        // hide legacy items from academic_subtype_c
        var academic_subtype_list = app.lang.getAppListStrings('academic_subtype_list');
        Object.keys(academic_subtype_list).forEach(function(key) {
            delete academic_subtype_list[key];
        this.model.fields['academic_subtype_c'].options = academic_subtype_list;

    I think there is a better way of doing this by manipulating the enum definition itself, something I've been planning to look into but it's not a high priority for us at this time.

    Similarly we check for the selection of a legacy value in the record view with an on change event on the field. If they select a legacy value there is an alert that reminds them they can't set that value. Not super-practical but annoying enough that they soon stop trying ;)

    Because we are on-site we have full control of our database so if we retire a value from a dropdown we often replace it using SQL in the back end with a new value and remove the old one from the dropdown itself. That needs to be done carefully of course and we don't do it often enough to consider it a problem (maybe twice in 12 years)

    The code above was added for one particular custom field on Accounts that has to sync back to the ERP system where we do not want to remove values for a variety of reasons I won't go into, and the dropdown values have to match between systems.

    Perhaps this will spark some ideas for you :) even simply adding the label (legacy) and pushing that value to the end of the dropdown list may get you to a point where your users know not to use that value anymore.


  • A better approach:

    User Role-Based Dropdowns:


    Create a Role that no one has which is not assigned to anyone in your company and call it "Legacy" 

    Then set the dropdown values so that only the "Legacy" Role has visibility of those items you want to retire.

    I have not tried this but will make a note to do so.

    To the best of my understanding (I've not tried) the Role based dropdown settings mean the user can see the value but not use it when creating/updating.


  • Great point,  . I don't think you need to create a legacy role though. You would just need to have one or more roles for your users that restrict visibility of the 'retired' dropdown options.

    I just tested using role-based dropdowns for this purpose and they function as you understand. If the record is associated with a value the user doesn't have access to via their role, they will still see the value and when editing the record, the value will show in the dropdown list (so it can still be saved with that value). If the user changes it to one of the values they have access to, then they will not be able to change it back to the role-restricted value. 

    Using this approach means all regular users need to belong to a role and depending on how many roles you use, you need to ensure all those roles are maintained to remove visibility of outdated dropdown options. Also, be aware that admin users would still see all dropdown options since they do not adhere to role restrictions. 


  • I think having admins be able to se the legacy roles is not a bad thing. There may be scenarios where they indeed need to. And admins should know what's what so not terrible. Adding  a legacy label may help everyone understand why these roles are restricted.