现在的位置: 首页 > 综合 > 正文

[Salesforce] Describe 总结

2012年06月05日 ⁄ 综合 ⁄ 共 448字 ⁄ 字号 评论关闭

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

 

 

 

抱歉!评论已关闭.