Friday, 15 January 2010

salesforce - Get a list of API Names of all Fields for an Object. -



salesforce - Get a list of API Names of all Fields for an Object. -

is possible list of api names fields on object?

schema.describesobjectresult r =object__c.sobjecttype.getdescribe(); list<string>apinames = new list<string>(); for(schema.describesobjectresult result : r){ apinames.add(); //this lost. }

you can utilize fields method schema.sobjecttypefields.

schema.describesobjectresult r = account.sobjecttype.getdescribe(); list<string>apinames = new list<string>(); for(string apiname : r.fields.getmap().keyset()){ apinames.add(apiname); } system.debug(apinames);

salesforce schema apex-code

No comments:

Post a Comment