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
ChitraChitra 

Extracting the complete list of feilds for a SObject

Hello..

I m trying to get the complete list of feilds ( member variables) associated with an Object in Salesforce.

com.sforce.soap.enterprise.Field[] fields = dsor.getFields();

where dsor is of type com.sforce.soap.enterprise.DescribeSObjectResult          

This call does not return every field associated with the object. (It returned only 140 /155) . The objects that were not returned were a mix of both the custom and default fields and not even bounded by the datatype ( mix of picklist and Integer .. etc) or ownership.

Am I missing something. Do we have any other API call to return all the fields...

Thank you,

Chitra

 

adamgadamg
> This call does not return every field associated with the object. (It returned only 140 /155) .

140 out of 155 fields? What object are you trying to describe? What fields is it not returning that you are aware of?

> The objects that were not returned were a mix of both the custom and default fields and not even bounded by the datatype ( mix of picklist and Integer .. etc) or ownership.

Describe does not filter based on type; you can determine the type from the describe result, however.
ChitraChitra

I m trying to describe the Salesforce objects like Accounts, Account Share etc..

It returns only 140 fields of the 150 odd total fields in Accounts ( Was stated as an example) ..

I get the complete list (150 / 150 for Account) if I get the fields using Java reflections. So either the .getFeilds (in salesforce API) is not doing all that it is supposed to do or the Java reflections extracting more fields than requried.

I verified the Fields that were missing . It had some system fields like '__equalsCalc' and some custom fields (for example CheckList__c) . I can understand why the Salesforce API leaves out the system fields. But what puzzles me are the Custom fields.

So it is a bug I m looking at or Wrong implementation from my part.

Chitra

 

zakzak
There are various properties on the generated classes that are implementation details of the client code, and nothing todo with the SOAP messages or SForce service, you see this with other tools as well (e.g. .NET which has additional XXXSpecified properties)
ChitraChitra

 

But It still doesnt answer my question on missing custom fields that I created for the Objects...

Chitra

adamgadamg
Reflection should return more fields than describe, as reflection includes standard Java methods inherited from Object (clone, toString, etc); Describe is also always up to date, whereas your WSDL/objects are a snapshot in time - if you delete a custom field it will still be in your Object until you regenerate the proxies. Finally, a permissions issue could prevent you from seeing fields in describe that are in your Java object.

If there is a custom field that you are sure exists via your login (check with the sforce Explorer tool at sforce.sf.net), re-generate your WSDL and Objects. If its still not there let us know so we can find the problem.
djordandjordan

If you are using record types on that entity, make sure that all fields exist in the page layout associated with the master record type. Also make sure you're logged into the API as an administrator.

David

ChitraChitra

I am not able to see the custom field that are in the object. So I know they exist, except the describe doesnt extract it. I checked when these custom fields were added , and they are not recent and I have regenerated the WSDL many times after that.

" if you delete a custom field it will still be in your Object until you regenerate the proxies"

I am one of the admin . It is still an error if the some fields are not accessible for the admin profile.

 Finally, a permissions issue could prevent you from seeing fields in describe that are in your Java object.

Here is an example

Account
The Field List Length from Get Fields:140 for:Account
The Field List Length from Java:158

AccountShare
The Field List Length from Get Fields:9 for:AccountShare
The Field List Length from Java:12

I absolutely understand the difference of 3 in the Account Share and other Objects- The 3 being the

__equalsCalc
__hashCodeCalc

class$com$sforce$soap$enterprise$sobject$Account

The Other 15 fields are Custom fields..!!!

If there is a custom field that you are sure exists via your login (check with the sforce Explorer tool at sforce.sf.net), re-generate your WSDL and Objects. If its still not there let us know so we can find the problem.

Any suggestion is appreciated.

Thank you

Chitra

ChitraChitra

I use the admin layout which is pretty much all the fields for all Tabs. Am I missing something else???

Thank you,

Chitra

DevAngelDevAngel

Hi Chitra,

One last question.  Are all the custom fields added to the admin layout?  When creating a custom field it needs to be explicitly added to a layout.

DevAngelDevAngel

Hi Chitra,

Can you tell me what Get Fields means?  I assume From Java means what is represented in the generated proxy, correct?

ChitraChitra

some of the custom fields are added to all the layouts.. Some are added to specific layout + ofcourse the admin..!

The admin layout just picks all the fields for the corresponding object and displays.. Did I answer your question..??

Thank you,

Chitra

ChitraChitra

Get Field : Corresponds to the .getFields() Method in the describeSObject API.

The Java : refers to the List generated using Java Reflection (Extracing a single object and its corresponding fields and the value)

Thank you,

Chitra