RemoveOption doesn't work for new model

RichyOrm
Tera Contributor

Hello,

 

I have the following function, it works fine for 'Normal' and 'Emergency' models, but it does not remove options for a model I created 'Nespresso'. Do I need to setup the model in Script Includes or something?

 

function onLoad() {
if (g_form.getReference('chg_model').name == 'Normal' || g_form.getReference('chg_model').name == 'Emergency') {
  g_form.removeOption('close_code', 'Completed');
  g_form.removeOption('close_code', 'Completed with issues');
  g_form.removeOption('close_code', 'Failed');
  g_form.removeOption('close_code', 'Unauthorized');
  g_form.removeOption('close_code', 'Cancelled');
  g_form.removeOption('close_code', 'Rolled back');
  g_form.removeOption('close_code', 'Policy violation');
}
  if (g_form.getReference('chg_model').name == 'Nespresso') {
  g_form.removeOption('close_code', 'Unsuccessful');
  g_form.removeOption('close_code', 'Successful');
  g_form.removeOption('close_code', 'Successful with issues');
  }
}

 

Interestingly, if I try adding g_form.addOption('close_code', 'Test'); for the new model it adds a blank record

1 REPLY 1

RichyOrm
Tera Contributor

Can ignore, I found the actual values via 'Configure Dictionary'