0

I have an object Event_Booking__c. I want to get all the fields from that object which is related to the Event__c object through Event_ID__c lookup.

Any idea on how to do this?

Lennon Leopoldo
  • 461
  • 7
  • 25
  • u can refer this previous discussion on how to select all fields from an object : http://salesforce.stackexchange.com/questions/49711/howto-wildcard-select-to-query-all-fields-of-objects-in-apex – Vamsi Krishna Gosu Aug 20 '15 at 03:01
  • @VamsiKrishna what I mean sir is get all the fields.. Not the Select * function or get data from fields selected.. – Lennon Leopoldo Aug 20 '15 at 03:07
  • u mean something like this ? http://salesforce.stackexchange.com/questions/60710/how-to-get-all-fields-from-any-object-and-its-parent-object-in-apex?rq=1 – Vamsi Krishna Gosu Aug 20 '15 at 03:24

1 Answers1

3

You can use Dynamic Apex to perform describe call on object for which you want to get meta-data as described in below example:

List<String> fields = new List<String>();
fields.addAll((Event__c.SObjectType.getDescribe().fields.getMap().keySet());

Above code will return all fields of Event__c Object which will get stored in List of type String.

Ajay Gupta
  • 925
  • 9
  • 23