Francesca Shiekh

Dynamic Dropdown renders but does not save?

Discussion created by Francesca Shiekh on Sep 18, 2016
Latest reply on Oct 13, 2016 by Francesca Shiekh

I am building a custom Scoring module with a dynamically populated dropdowns.


Simplifying the picture to get to the point:

I have a score_field enum with a dynamic dropdown list of field names for a given module (field name => label).


When a score_field is chosen, a modification to the enum field type for the Scoring module changes the score_field_value field's multienum dropdown options to the list of options of the corresponding score_field in the original module.


For example, I choose Leads as the module, when I set the score_field = "status" the dropdown options for the multienum score_field_value are set to lead_status_dom.


So far so good. I see the correct list of fields in score_field_value and can choose those values and populate the multienum.


The problem is when I Save the Scoring record, it saves the score_field correctly as "status" but does not save the score_field_values I chose from the lead_status_dom. They are not visible from the front end and are not set in the corresponding database record and I can't figure out why.


I have used this method before but it has always been to restrict an existing dropdown list to a subset of said list. I suspect the problem is that the original placeholder list doesn't have any of these values and there is some validation during the save process that is preventing me from using these "new" values.


So the question is: Is there validation of the enum values prior to saving that I need to somehow override to get this to work?




  extendsFrom: 'EnumField',
  initialize: function(opts){
  initEvents: function(){
  score_fieldDropdownFieldChange: function() {
     //when score_field is changed look up the proper values for the dropdowns
     if( == 'score_field'){
        //trigger when score_field is loaded
        this.on('render', this.triggerEnumDropdownFieldsChange, this);
        //trigger when score_field changes 
        this.model.on('change:'+, this.triggerEnumDropdownFieldsChange,this);
  enumDropdownFieldsChange: function(){
     if( == 'score_field_value'){
           this.model.on('parent:module:change', function(ddOptions){
             var opts = {};
             if( == 'score_field_value'){
                if(!_.isUndefined(ddOptions) && !_.isEmpty(ddOptions)){
                   //show the dropdown //hide the text
                   this.def.options = ddOptions;
                   this.items = {};
                   //no options
                   //hide the dropdown //show the text
           }, this);
  triggerEnumDropdownFieldsChange: function(){
     var ddOptions = '',
         self = this,
         score_field = self.model.get('score_field'),
         scoring_id = self.model.get('wsco_scorecriteria_wsco_scoringwsco_scoring_ida'),
         scoringBean ='wsco_Scoring', {id:scoring_id}),
         requestParent = scoringBean.fetch();
        var scoring_module = scoringBean.get('scoring_module'),
            scoringModuleMeta = app.metadata.getModule(scoring_module);
            //ddOptions = app.lang.getAppListStrings(scoringModuleMeta.fields[score_field].options);
            ddOptions = scoringModuleMeta.fields[score_field].options;


Any help is appreciated,