You need to sign in to do that
Don't have an account?
Sandeep Rahul PV
How to add and remove values from Picklist Value sets (Global Pick list) ?
Hi Team,
I have created a Picklist Value set and I referred this to a custom picklist field. Now the requirement is I need to update the Picklist value set through apex on the batch run. Help me.
Thank you
Sandeep.
To access picklist values from a trigger or server controller in Apex, you can use dynamic Apex. It lets you analyze objects and fields programmatically with methods from the Schema namespace. (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Schema.htm)
The following code sample shows how you can retrieve picklist values for the “Industry” field of the “Account” object as a list of Schema.PicklistEntry (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_PicklistEntry.htm) using getDescribe() and getPicklistValues(): Related:
https://www.phoneiq.co/blog/how-to-check-picklist-values-with-apex-in-salesforce
https://developer.salesforce.com/blogs/developer-relations/2008/12/using-the-metadata-api-to-retrieve-picklist-values
https://help.salesforce.com/s/articleView?id=sf.updating_picklists.htm&type=5
https://github.com/pozil/picklist-utils
Thanks.