0

There is a global value set that we need to fetch in the Apex class. There are some solutions which are using REST call to Tooling API for accessing them.

However, I want to know, is it possible to fetch GlobalValueSet in Apex without REST call?

It could be either using SOQL or some other way.

SOQL Query: SELECT Metadata FROM GlobalValueSet WHERE DeveloperName = 'Talent_Role'

GlobalValueSet

1 Answer 1

2

If you're global value set is being used as a value set for a picklist, you can retrieve it by getting the picklist values for that field.

To do that you use the following:

Schema.DescribeFieldResult fieldResult = ObjectAPIName.FieldAPIName.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
1
  • 1
    Makes sense. I was trying to fetch GlobalValueSet values directly which requires tooling API. Thanks Commented Dec 15, 2022 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .