Remove choices except a few choices

1_DipikaD
Kilo Sage

Hi All,

 

I want to remove all the existing choices from a choice field without removing a few choices(suppose 5) .

 

Thank you

7 REPLIES 7

Eshwar Reddy
Kilo Sage

Hi @1_DipikaD 
If it is a Select Box:
Use the following code in client Script
g_form.removeOption('field name', 'value')


Thanks
Esh

But I want to make it dynamic that whatever choices are present in that choice field except those 5 choices should be removed .

Mark Manders
Mega Patron

Can you elaborate? Is this to only show a few choices based on conditions, or do you need to just never show them? In the first case, use a client script like Eshwar told you already and if you are just never going to use the choice, you can go to the dictionary entry of the field and inactivate the choices you don't want. Don't delete them. OOB choices will probably get back when you upgrade/patch and any choice may have been used somewhere in the past and is now in reports. Deleting them, will also delete them from records.
If it's choices on a variable where you custom created them (so not a reference to choices from an existing table), you can just delete them, if you no longer need them, because they will remain on the records that have been created from the record producer/catalog item.

 

If it is something else, please elaborate on what you are trying to do.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Actually before the field type was string but now I converted it to a choice field adding a few choices in dictionary and the pre-existing values in that string field now getting  populated on a different field when user select others from the current choice field. But in QA and UAT the field is getting a few choices different from the choices added by me. So I want remove those extra choices which are not added by me.

As the solution provided by Eshwar, it will remove the particular choices but the matter is the extra choices which are present in DEV,QA and UAT are different from each other. So that I want all those choices to be removed which are not the choices added by me .

 

Thank you