Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From within Apex, you can get this by running the following Apex code snippet. If your table/object is named <code>MyObject__c</code>, then this will give you a Set of the API names of all fields on that object that you have access to (this is important --- even as a System Administrator, if certain fields on your table/object are not visible through Field Level Security to you, they will not show up here):</p> <pre><code>// Get a map of all fields available to you on the MyObject__c table/object // keyed by the API name of each field Map&lt;String,Schema.SObjectField&gt; myObjectFields = MyObject__c.SObjectType.getDescribe().fields.getMap(); // Get a Set of the field names Set&lt;String&gt; myObjectFieldAPINames = myObjectFields.keyset(); // Print out the names to the debug log String allFields = 'ALL ACCESSIBLE FIELDS on MyObject__c:\n\n'; for (String s : myObjectFieldAPINames) { allFields += s + '\n'; } System.debug(allFields); </code></pre> <p>To finish this off, and achieve <code>SELECT * FROM MYTABLE</code> functionality, you would need to construct a dynamic SOQL query using these fields:</p> <pre><code>List&lt;String&gt; fieldsList = new List&lt;String&gt;(myObjectFieldAPINames); String query = 'SELECT '; // Add in all but the last field, comma-separated for (Integer i = 0; i &lt; fieldsList.size()-1; i++) { query += fieldsList + ','; } // Add in the final field query += fieldsList[fieldsList.size()-1]; // Complete the query query += ' FROM MyCustomObject__c'; // Perform the query (perform the SELECT *) List&lt;SObject&gt; results = Database.query(query); </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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