Can dropdown values be hidden in dropdown but available for reporting
Can dropdown values be hidden in dropdown but available for reporting
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]); this.hideLegacyValues(); }, 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) { if(academic_subtype_list[key].match(/legacy/)){ 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.
FrancescaS
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]); this.hideLegacyValues(); }, 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) { if(academic_subtype_list[key].match(/legacy/)){ 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.
FrancescaS