Tho*_*ler 3 schema salesforce apex-code
是否可以获取对象上所有字段的所有API名称的列表?
Schema.DescribeSObjectResult r =Object__c.sObjectType.getDescribe();
List<String>apiNames = new list<String>();
for(Schema.DescribeSObjectResult result : r){
apiNames.add(); //this is where I am lost.
}
Run Code Online (Sandbox Code Playgroud)
您可以使用fields方法获取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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11704 次 |
| 最近记录: |