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
sandeshdsandeshd 

getDescribe() method is not working

Hi,

 

getDescribe() method is not working . 

 

code:

 Schema.Describefieldresult result = Quote.test__c.getDescribe();

 

It gives me error saying that : Method does not exist or incorrect signature: [String].getDescribe()

 

but the code snippet is working fine in developer console or execute Anonymous block.

 

Pls suggest... I have read in Some blog that there its a problem with version of the class,  I tried changing it but still the issue isnt resolved.

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
MTBRiderMTBRider

I think it should be:

 

Schema.Describefieldresult result = Schema.sObjectType.Quote.fields.test__c;

 

result = result.getSObjectField().getDescribe();

 

page 167 of the Apex developers guide.

All Answers

MTBRiderMTBRider

I think it should be:

 

Schema.Describefieldresult result = Schema.sObjectType.Quote.fields.test__c;

 

result = result.getSObjectField().getDescribe();

 

page 167 of the Apex developers guide.

This was selected as the best answer
sandeshdsandeshd

Oh thank you. it worked...

 

As I mentioned in my earlier post 

 

Schema.Describefieldresult result = Quote.test__c.getDescribe();

 

 this was working fine in my developer console and anonymous block but not in code.... Not sure why we have this inconsistency ..

 

Any ways thank you again.