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
Juan SpagnoliJuan Spagnoli 

Schema Describe FieldSets is not working!

Hi guys, I realized than from the 25.0 API version, SObject describe's methods are not working fine, I tried the example in Force.com Apex Guide and gave me an empty map:

 

Map<String, Schema.FieldSet> FsMap =  Schema.SObjectType.Account.fieldSets.getMap();

 Same with:

 

Schema.DescribeSObjectResult d = Account.sObjectType.getDescribe();
Map<String, Schema.FieldSet> FsMap = d.fieldSets.getMap();

 or with:

 

Schema.SObjectType sot = Schema.getGlobalDescribe().get('Account');
Schema.DescribeSObjectResult d = sot.getDescribe();
Map<String, Schema.FieldSet> FsMap = d.fieldSets.getMap();

 

Anyone had the same problem? Is there any solution to this issue?

 

Thanks a lot.

Rahul SharmaRahul Sharma
I tested them , All 3 of them are working in version 26.
Juan SpagnoliJuan Spagnoli

Hi Rahul, one question: What kind of org are you using for test it? A Developer org?

  

Thxs

Rahul SharmaRahul Sharma
Yes Juan. I'm using a developer org. I'll try it in my sandbox too.
Juan SpagnoliJuan Spagnoli

Mmm... I don't understand.. I'm trying in a DEV too

 

If I try:

 

Schema.SObjectType sot = Schema.getGlobalDescribe().get('Account');
Schema.DescribeSObjectResult d = sot.getDescribe();
Map<String, Schema.FieldSet> FsMap = d.fieldSets.getMap();
system.debug(LoggingLevel.INFO, '>>> ' + FsMap);

 I get:

 

17:25:34:048 USER_DEBUG [4]|INFO|>>> {}

 

Rahul SharmaRahul Sharma

It is working in my sandbox too.

 

Input:

Map<String, Schema.FieldSet> FsMap =  Schema.SObjectType.Account.fieldSets.getMap();
system.debug('$$$$'+FsMap);

Output:

01:58:50:042 USER_DEBUG [2]|DEBUG|$$$${test=Schema.FieldSet[getDescription=home;getFields=(Schema.FieldSetMember[getDbRequired=true;getFieldPath=CurrencyIsoCode;getLabel=Account Currency;getRequired=false;getType=PICKLIST;], Schema.FieldSetMember[getDbRequired=false;getFieldPath=Description;getLabel=Account Description;getRequired=false;getType=TEXTAREA;], Schema.FieldSetMember[getDbRequired=false;getFieldPath=Fax;getLabel=Account Fax;getRequired=false;getType=PHONE;], Schema.FieldSetMember[getDbRequired=true;getFieldPath=Id;getLabel=Account ID;getRequired=false;getType=ID;], Schema.FieldSetMember[getDbRequired=true;getFieldPath=Name;getLabel=Account Name;getRequired=false;getType=STRING;], Schema.FieldSetMember[getDbRequired=false;getFieldPath=AccountNumber;getLabel=Account Number;getRequired=false;getType=STRING;], Schema.FieldSetMember[getDbRequired=false;getFieldPath=Phone;getLabel=Account Phone;getRequired=false;getType=PHONE;], Schema.FieldSetMember[getDbRequired=false;getFieldPath=Rating;getLabel=Account Rating;getRequired=false;getType=PICKLIST;], Schema.FieldSetMember[getDbRequired=false;getFieldPath=Site;getLabel=Account Site;getRequired=false;getType=STRING;], Schema.FieldSetMember[getDbRequired=false;getFieldPath=AccountSource;getLabel=Account Source;getRequired=false;getType=PICKLIST;], ...);getLabel=test;getName=test;getNameSpace=null;getSObjectType=Account;]}

 Try it in console log too.

Try logging a case to salesforce.

Juan SpagnoliJuan Spagnoli

Yes, I tried in the console log and in an apex class with differents api versions.. nothing..

 

I tried your example:

 

Map<String, Schema.FieldSet> FsMap =  Schema.SObjectType.Account.fieldSets.getMap();
system.debug('$$$$'+FsMap);

 And I got:

 

17:35:09:030 USER_DEBUG [2]|DEBUG|$$$${}

 : /

 

I tried it in 2 different DEV's Orgs and in one production's org,  all different servers... this is really weird!

 

Thanks for your help.

 

Best Regards,

Juan.

Rahul SharmaRahul Sharma
Is it resolved or have you tried contacting salesforce support?
sandeep@Salesforcesandeep@Salesforce

I faced same problem earlier and update my org and it was returning results now happy:)