码家

Web Platform, Cloud and Mobile Application Development

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1.

map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();

map的key是 object api name

比如 “Account”


可以: gd.containsKey(“Account”)  去判断一个object里有没有那个field

 

2.

map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();

Schema.SObjectType sot = gd.get(objApi);

Schema.DescribeSObjectResult sobjr = sot.getDescribe();

 

3.

map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();

Schema.DescribeSObjectResult sobjr = gd.get(objApi).getDescribe();

objApi 是 object api name

 

 

 

posted on 2012-11-12 15:24  海山  阅读(346)  评论(0)    收藏  举报