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
CC FTCC FT 

how to get all fields info includes parent records values for a particular record

I want to get all fields information which includes parent records details as well.
let suppose query is like, select * from contact.
Here contact is child object of Account, So i need account all feilds as well.

Is This Possiable?
Note: I wil have only recordID, based on i need all above info.
Any alternative soution other than Apex code?
Guys, please help me on this.
surasura
sadly there is no direct soql way to do this except sepcifying each field in your select statement. Salesforce explanation is it is to avoid querying unnecessary fields which can result governor limits

you can query all fileds of a object using apex and dynamic soql .but still you cant query all the parent fields without specifically mentioning them 
http://salesforcecat.blogspot.com/2014/10/salesforce-soql-query-all-fields.html
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for same
1) http://amitsalesforce.blogspot.com/2016/03/dynamic-query-select-all-field-in-soql.html

Sample code for you
public Void GetAllField()
{
 String query ='';
 String SobjectApiName = 'Account';
 Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
 Map<String, Schema.SObjectField> fieldMap = schemaMap.get(SobjectApiName).getDescribe().fields.getMap();

 String strFields = '';
 
 for(String fieldName : fieldMap.keyset() )
 {
  if(strFields == null || strFields == '')
  {
   strFields = fieldName;
  }else{
   strFields = strFields + ' , ' + fieldName;
  }
 }

 query = 'select ' + strFields + ' from ' + SobjectApiName + ' Limit 10 ';

 List <Account> accList = Database.query(query);
 
}