update the massupdate options dropdown to not include options?

Hello 

So I am trying to setup the massupdate feature in a certain module (opportunities) so that when "Sales Stage" is Selected -- the option of  "Closed Lost" does not appear as a selection.

I have managed to pinpoint the Select Element "sales_stage" and have updated the options associated but yet the drop is still there.

I created this function that I call before render hoping it will alter the list options.

manipulateDrop: function() {
   var salesdrop = app.lang.getAppListStrings('sales_stage_dom');
   Object.keys(salesdrop).forEach(function(key){
   if (salesdrop[key] === "Closed Lost") {
      delete salesdrop[key];
   }
});
this.model.fields['sales_stage'].options = salesdrop;
},

On the page I inspect and see that the select dropdown options do not contain the "closed Lost" option yet it is still there. 

Does anyone have an idea as to why i cant hide this via the JS? 

  • For this to work the code needs to be run in the set_metadata function of the massupdate.

    //Target the Opportunities.
    var SS = app.metadata.getModule('Opportunities').fields.sales_stage;
    //get the sales stage drop and alter.
    var salesdrop = app.lang.getAppListStrings('sales_stage_dom');
    Object.keys(salesdrop).forEach(function(key){
       if (salesdrop[key] === "Closed Lost") {
          delete salesdrop[key];
       }
    });
    //set the target
    SS.options = salesdrop;

    then you can call the _super setMetadata  -- your removed option will not be in the dropdown.