function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
myluckymylucky 

Update a Value in Dynamic Picklist

How can we update a value in the dynamic picklist..??? I am explaining my requirement here.

 

 

List<SelectOption> abc = new List<SelectOption>();

abc.add(new SelectOption('apex',ApexDevelopment);

 

 

Now I have to change the 'ApexDevelopment' value to 'VisualforceDevelopment' by removing the value ApexDevelopment in the picklist.

 

I tried "abc.remove(apex)", it shows an error as : Method does not exist or incorrect signature: [LIST<System.SelectOption>].remove(String)   

Can any one help me pls.......

 

 

Thanks in advance,

Lakshmi Reddy. B

Kevin SwiggumKevin Swiggum

Lists don't have the ability to remove by "key". Best you can do with remove is call abc.remove(0) which will remove an item from the list based on index/position...and that's only if you know that the apex select option is the first value in the list. 

 

You're other option would be to just reinitialize the abc list and repopulated it with the correct values.