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
Connor CainConnor Cain 

Activate all picklist values using Apex

hello Everyone,

As strange as it sounds I am looking for a way to Activate all picklist values on the field level and recordtype level on an Object using Apex. This way, for a time, all records with deactivated values can be cloned or inserted.

 
Abdul KhatriAbdul Khatri
@Connor Cain.

You can make use of the tooling api. There is a github source available with comprehensive libraries to use instead of you inventing the wheel
https://github.com/financialforcedev/apex-mdapi/tree/master/apex-mdapi/src/classes

Here is the example how to use it
https://developer.salesforce.com/forums/?id=9060G000000XbVHQA0

Let me know if this help