zoukankan      html  css  js  c++  java
  • 67、saleforce的object的describe方法使用

    使用Schema类的describesSObjects方法获取描述sObject结果.使用此方法可以通过sObject类型名称描述一个或者多个sObject描述信息。

    //sObject types to describe
    String[] types = new String[]{'Account','Merchandise__c'};
    //Make the describe call Schema.
    DescribeSobjectResult[] results = Schema.DescribeSObjects(types);
    System.debug('Got describe information for '+ results.size() + 'sObjects.');
    //For each returned result, get some info
    for(Schema.DescribeSObjectResult res : results) {
        System.debug('sObject Label:'+res.getLabel());
        System.debug('Number of fields:'+res.fields.getMap().size());
        System.debug(res.isCustom()?'This is a custom object.':'This is a standard object.');
        Schema.ChildRelationship[] rels = res.getChildRelationships();
        if(rels.size()>0){
            System.debug(res.getName() + 'has' + rels.size() +'child relationships.');
        }
    }

     首先给大家看一下结果:

  • 相关阅读:
    第十二周作业
    第十一周作业
    第十周作业
    第九周作业*
    #**第八周作业+预习作业**
    第七周作业
    Linux 日志查看常用命令
    Linux tar命令
    Java 数组
    设计模式 观察者模式(Observer)
  • 原文地址:https://www.cnblogs.com/weizhen/p/6419374.html
Copyright © 2011-2022 走看看