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
Zaid Farooqi 7Zaid Farooqi 7 

Finding the SOQL query

Hello,

how can I find out what the associated SOQL query is to a field in SFDC. For example if I want to know what the SOQL query for an account field named 'Account Name' is?
Bryan Leaman 6Bryan Leaman 6
To find the actual field developer name to use in a SOQL query, go to the fields section of the object definition and search for the field label.

In lightning: Go to Setup | Object Manager, key in the object label ("Account"), click on the "Account" object name, click on "Fields & Relationships" and then key in all or part of the field label. Both the field label and the field name are shown on-screen.

Find Account name field in lightning

In classic for standard objects (like Account): Go to "Setup | Customize | {object name, like "Account"} | Fields" 
In classic for custom and managed objects: Go to "Setup | Create | Object", search for your object label and click on it. Search in the "Standard Fields" and "Custom Fields & Relationships" sections.

Account field names

There are also some Chrome extensions that can give you access to this information from a record page, like "Salesforce inspector".
harsha__charsha__c
Use workbench (https://workbench.developerforce.com" target="_blank) >> SOQL Query option. This lists you all the fields as you choose an object.

Hope this helps.

-Harsha
Deepali KulshresthaDeepali Kulshrestha

Hi Zaid,

I have gone through your problem please refer bellow code:

Apex Class:

public class TestAccount {
    public static void testAccount(){
        List<Account> laccount=[select Id,Name from Account];
        System.debug(laccount);
    }
    
    
}

In this code, you can find Account Name.
You can also use any object API name and find the related field.

You can also refer below link:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_account.htm


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com