6

I am looking for a field named "Owner_c" in all Objects. Any easy way to find it through work bench or a query in Developer Console.

10

SOQL/SOSL won't help you here. You can, however, write a query using the Tooling API like this:

SELECT Id,TableEnumOrId FROM CustomField WHERE DeveloperName = 'Owner'

The easiest way to do this is to open the Developer Console, click the Query Editor tab, check the "Use Tooling API" checkbox, and type in the query. Note that you do not include the __c when querying this table.

For custom objects, you'll get a custom object ID. You can see the object by using the standard URL for an object:

https://<domain>.salesforce.com/01IC0000000XXXXXXX

Tooling API query in Developer Console

0
1

You should be able to do it using Force.com IDE or Mavensmate. Search in the metadata folder. There will be break down of all the fields by object level.

Steps for Mavensmate:

  1. Open Project Folder>>Config
  2. Open ".org_metadata" folder
  3. Search for ".fields.Field_You_Are_Looking_For__c"

The usual structure for config definition is :

Account.fields.Field_You_Are_Looking_For__c, Opportunity.fields.Field_You_Are_Looking_For__c, Contact.fields.Field_You_Are_Looking_For__c

So ".fields.Field_You_Are_Looking_For__c" will get the Field_You_Are_Looking_For__c across all the objects.

There should be something very similar in Eclipse too.

1
  • Thanks for the reply. i wanted to try this solution but couldnt. somehow i have issue logging in using Mavensmate and Eclipse. it took me 6 hours to install and try both. EOD couldnt add the project. Dec 30 '15 at 22:21
0

This cycle in debugger worked for me

Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
for (Schema.SObjectType m1 : schemaMap.values()){
    String objName =  String.valueOf(m1);
    Schema.SObjectType s = (SObjectType) schemaMap.get(objName);
    Map<String,Schema.SObjectField> tfields = s.getDescribe().fields.getMap();
    for (Schema.SObjectField m2 : tfields.values()){
        String fieldName =  String.valueOf(m2);
        if(fieldName.equals('YOUR_FIELD')){
            System.debug(m1);
        }
    }   
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.