0

I have created an option set field in an entity in CRM that has 3 options.

Now I want to add another option based on some conditions dynamically(maybe when the page loads).

Is it possible to do that?

Thanks in advance.

user9088454
  • 1,076
  • 1
  • 15
  • 45
pcghose
  • 179
  • 16
  • I think you cannot create new Option set Value/Option on the fly which is not available in Database/Metadata. – AnkUser Aug 05 '19 at 14:32

1 Answers1

0

To make sure it can save into the database and be available in other places like views.

You should create an option set with every possible value.

Then use JavaScript to hide the options you don't want.

removeOption

formContext.getControl("your_control").removeOption(1);
James Wood
  • 17,286
  • 4
  • 46
  • 89
  • I know that. But my question was whether is it possible to add options dynamically in the option set that are not present in metadata? – pcghose Aug 05 '19 at 09:35
  • I think you could use `addOption` to show it on screen, but I'm not sure it will save into the database. – James Wood Aug 05 '19 at 09:37