开发者

Read all custom fields from opportunity object in salesforce

I need to read all custom fields from Opportunity object using apex , how is that开发者_开发问答 possible ?


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


Its not generally good practice to query all fields, especially objects in the cloud, in not good for speed and efficiency. Can you not just specify the fields you want?

try the Salesforce describe method to loop or get fields if you cant specify:

describe methods

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜