0

Is there there an easy way which i can produce a Salesforce report which returns the following headers ;

Singular Label Plural Label Object Name API Name Custom

Desired outcome would be ;

Singular Label : AML Process Plural Label : AML Processes Object Name : AML_Process API Name : AML_Process__c Custom : Yes

I have found the following article (see below) which is what i am after, however i am struggling to add in the other fields which i require http://developer.force.com/cookbook/recipe/retrieve-a-list-of-objects-using-apex

looking forward to your help Regards

1 Answer 1

1

Modify this code to meet your needs. I have just printed it in double log.

You should be able to generate VF report with this.

List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();     

for(Schema.SObjectType f : gd)
{
   //options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
    System.debug('Singular Label ' + f.getDescribe().getLabel()); 
    System.debug('Plural Label ' + f.getDescribe().getLabelPlural()); 
    System.debug('Object Name ' + f.getDescribe().getName().replace('__c','')); 
    System.debug('API Name ' + f.getDescribe().getName()); 
    String s = '';
    If( f.getDescribe().getName().indexOf('__c') > 0) 
        s = 'Yes'; 
    else 
        s = 'No';
    System.debug('Custom ' + s) ; 
    //System.debug('Custom ' + f.getDescribe()); 
}
6
  • Hi Atul. when i use that code i get this error warning "Error: Compile Error: unexpected token: 'List' at line 1 column 0 " Commented Mar 4, 2016 at 12:55
  • where are you executing this code? run this in anonymous block Commented Mar 4, 2016 at 14:04
  • This works fine for me with anon-apex. Commented Mar 4, 2016 at 14:18
  • HI - i am executing this code in developer console. However i am confused by the results being returned. and also i dont get how to referencing this in visual force. Sorry for being naive. Really appreciate your help Commented Mar 7, 2016 at 10:53
  • You need to learn 2 things. 1) how to use developer condole help.salesforce.com/HTViewHelpDoc?id=code_system_log.htm 2) how to bind apex variable in VF. developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/… Commented Mar 7, 2016 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .