3

I need to get schema.SObjectType values , those values are dynamically used in SFDC Apex class. Do we have any API which i can able to get those fieldset values in java , i tried Enterprise,metadata API but i could not able to find.

 List<Schema.FieldSetMember> fields = Schema.SObjectType.Case.fieldSets.getMap().get(parentFS).getFields();
1

The Tooling API has EntityDefinition, which includes the FieldSets field. From FieldSet should should be able to get:

  • Description
  • DeveloperName
  • MasterLabel
  • NamespacePrefix

I tried the following SOQL query against the Tooling API with some success:

Select Id, KeyPrefix, Label, QualifiedApiName, (Select DeveloperName from FieldSets) From EntityDefinition where QualifiedApiName = 'Case'

If I omit the where clause I get a GACK 843676008-103722 (-365459068), which is always fun.


To get the data equivalent to the Apex FieldSetMember class you may need to do one of:

  1. Create a Metadata package to retrieve the FieldSet and FieldSetItem. This would only give you the API name of the field, if it is required, and if it is a managed field. You would need to look elsewhere in the meta data for the label etc...
  2. Create your own Apex web method or REST API that exposes the required data. See Is it possible to get an objects fieldsets with the REST API?
2
  • Thanks Daniel, Now i can able to get the fieldSet names, labels... I need to get the corresponding values for the fieldset. Can you please help me out , how to get the fieldset values for the particular fieldSet – Sathish Aug 26 '15 at 19:35
  • Can you please share the example how to do it using Metadata Package to retrive FieldSet, I tried but couldnt find it. Thanks for your help :) – Sathish Aug 27 '15 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.