[Salesforce] Describe 总结

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

 

 

 

你可能感兴趣的:(des)