Skip to content

Instantly share code, notes, and snippets.

@tyoshikawa1106
Created October 5, 2015 12:46
Show Gist options
  • Save tyoshikawa1106/6d42eb50f78d2757caf2 to your computer and use it in GitHub Desktop.
Save tyoshikawa1106/6d42eb50f78d2757caf2 to your computer and use it in GitHub Desktop.
Apex Schema
// オブジェクト情報
System.debug(Schema.getGlobalDescribe().get('Account').getDescribe());
// オブジェクトの項目情報
Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;
Schema.SObjectType s = m.get('Account') ;
Schema.DescribeSObjectResult r = s.getDescribe() ;
Map<String, Schema.SObjectField> fields = r.fields.getMap() ;
for (String f : fields.KeySet()) {
System.debug(f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment