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
Jitendra JangidJitendra Jangid 

way to get field description using partner API call

I'm using Partner API call to fetch various properties of field like field label, api name, data type. Along with these, I also would need to fetch field description but didn't find any method to fetching this particulr info.

Java code snip:

DescribeGlobalResult describeGlobalResult=partnerConnection.describeGlobal();                
DescribeGlobalSObjectResult[] sObjResults=describeGlobalResult.getSobjects();
Field[] fObjArray=sObjResult.getFields();
for(Field fObj:fObjArray){
System.out.println(fObj.getLabel()+ " "+fObj.getName());
}

Thanks in advance!
Best Answer chosen by Jitendra Jangid
NagendraNagendra (Salesforce Developers) 
Hi Jithendra,

You cannot get the Description using Describe calls in APEX.

A trick (and a very difficult one) is to use the Metadata API. You can do this via APEX - but the process is async. Since you want to fetch the information, it would require "retrieve" calls - and those are seriously difficult to do in APEX.

For more information please refer the below links:

http://andyinthecloud.com/2013/10/27/introduction-to-calling-the-metadata-api-from-apex/

http://www.salesforce.com/us/developer/docs/api_meta/api_meta.pdf

http://blog.jeffdouglas.com/2011/10/20/getting-salesforce-field-metadata-the-easy-way/

Please mark this as the best answer if it helps you.

Best Regards,
Nagendra.P

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Jithendra,

You cannot get the Description using Describe calls in APEX.

A trick (and a very difficult one) is to use the Metadata API. You can do this via APEX - but the process is async. Since you want to fetch the information, it would require "retrieve" calls - and those are seriously difficult to do in APEX.

For more information please refer the below links:

http://andyinthecloud.com/2013/10/27/introduction-to-calling-the-metadata-api-from-apex/

http://www.salesforce.com/us/developer/docs/api_meta/api_meta.pdf

http://blog.jeffdouglas.com/2011/10/20/getting-salesforce-field-metadata-the-easy-way/

Please mark this as the best answer if it helps you.

Best Regards,
Nagendra.P
This was selected as the best answer
Jitendra JangidJitendra Jangid
Thanks Nagendra! I explored lots and got to know that Desc field can't be retrived using partner api since describe class doesn't expose this field property. So, Metadata API is the only option to go with.