I need to read all custom fields from Opportunity object using apex , how is that possible ?
2 Answers
1
votes
public Map<String, Schema.SObjectField> M = Schema.SObjectType.Opportunity.fields.getMap();
fieldSet = M.keySet();
fieldSet
is a set of all fields as string, Either use it directly in the query or loop over it and prepare a string and use that in the query with Database.query
However note that it would consist of fields which are in Opportunity not of the relationship specific fields