You need to sign in to do that
Don't have an account?
Bruce Greer
Using API, how to add new value to picklist for standard field without changing existing values.
How do I use the Metadata API to add a new picklist value to a standard field that already has many custom values. Specifically, I do not want to overwrite the picklist because that would delete the custom values. I just want to add a single new value to the list.
Please refer below sample code.
In following code we add two and three as a picklist value Picklist__c field on Lead.
Use the following code in your APEX class:
Please refer below post for similar discussion.
https://help.salesforce.com/apex/HTViewSolution?id=000002778&language=en_US
http://salesforce.stackexchange.com/questions/49057/adding-values-to-a-picklist-using-apex
https://developer.salesforce.com/forums?id=906F000000092beIAA
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
Thank you for your quick response. However, I don't think this is going to work for me. Your code appears to *set* the picklist on a *custom* field. My requirements are that I need to *add* a new value to an existing picklist on a *standard* field. Specifically, I need to add a new value to the LeadSource picklist field on both the Lead and Contact standard objects.
Thanks!
-Bruce