Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are using the Salesforce API then you can use describeSObjects() to retrieve metadata about any object you are interested in, including the Account object.</p> <p>The syntax is:</p> <pre><code>DescribeSObjectResult [] = sfdc.describeSObjects(string sObjectType[] ); </code></pre> <p>Where sObjectType is an array of up to 100 objects.</p> <p>To describe an account, use:</p> <pre><code>DescribeSObjectResult [] = sfdc.describeSObjects("account"); </code></pre> <p>The DescribeSObjectResult array has many properties that can be used to discover information about the object. For example, if you want a list of the fields belonging to the account object, you would use DescribeSObjectResult.Fields.</p> <p>Here is some sample Java code from the <a href="http://www.salesforce.com/us/developer/docs/api90/Content/sforce_api_calls_describesobjects.htm#topic-title" rel="nofollow">Salesforce API Developer's Reference</a>. This should help you get started. There are also C# samples if you follow the link to the developers reference.</p> <pre><code>private void describeSObjectsSample() { try { DescribeSObjectResult[] describeSObjectResults = binding.describeSObjects(new String[] {"account", "contact", "lead"}); for (int x=0;x&lt;describeSObjectResults.length;x++) { DescribeSObjectResult describeSObjectResult = describeSObjectResults[x]; // Retrieve fields from the results Field[] fields = describeSObjectResult.getFields(); // Get the name of the object String objectName = describeSObjectResult.getName(); // Get some flags boolean isActivateable = describeSObjectResult.isActivateable(); System.out.println("Object name: " + objectName); // Many other values are accessible if (fields != null) { // Iterate through the fields to get properties for each field for (int i = 0; i &lt; fields.length; i++) { Field field = fields[i]; int byteLength = field.getByteLength(); int digits = field.getDigits(); String label = field.getLabel(); int length = field.getLength(); String name = field.getName(); PicklistEntry[] picklistValues = field.getPicklistValues(); int precision = field.getPrecision(); String[] referenceTos = field.getReferenceTo(); int scale = field.getScale(); FieldType fieldType = field.getType(); boolean fieldIsCreateable = field.isCreateable(); System.out.println("Field name: " + name); // Determine whether there are picklist values if (picklistValues != null &amp;&amp; picklistValues[0] != null) { System.out.println("Picklist values = "); for (int j = 0; j &lt; picklistValues.length; j++) { if (picklistValues[j].getLabel() != null) { System.out.println(" Item: " + picklistValues[j].getLabel()); } } } // Determine whether this field refers to another object if (referenceTos != null &amp;&amp; referenceTos[0] != null) { System.out.println("Field references the following objects:"); for (int j = 0; j &lt; referenceTos.length; j++) { System.out.println(" " + referenceTos[j]); } } } } } } catch (Exception ex) { System.out.println("\nFailed to get object descriptions, error message was: \n" + ex.getMessage()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload