Find your content:

Search form

You are here

Get all fields in lookup object

 
Share

I have a custom object called Job and Job has a couple of Lookup fields linking with Group, Account, Contact, Custom Object. If I iterate through each object I get:

Too many fields describes: 101

What's the best way to get Job object structure (including all fields and fields belong to those Lookup objects)?


Attribution to: user3211

Possible Suggestion/Solution #1

Describe Limits have been removed since Summer '14. So you just need apiVersion >= 28.0 in your -meta.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>28.0</apiVersion>
    <status>Active</status>
</ApexClass>

Attribution to: Adrian Larson

Possible Suggestion/Solution #2

Depending on your code you could try to execute the following using the REST API.

Object describe: http://www.salesforce.com/us/developer/docs/api_rest/Content/resources_sobject_describe.htm

Then you can filter the content and do a field describe: http://www.salesforce.com/us/developer/docs/api_rest/Content/dome_sobject_describe.htm

As the documentation suggests: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_field_tokens.htm#apex_describe_object_all_fields

You can only have 100fields member variable statements in an Apex class or trigger.


Attribution to: Philipp Rackwitz
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/34467

My Block Status

My Block Content