+ Start a Discussion
sfdc007sfdc007 

Org limit apex code

Hi,

I need help on the following requirement as follows


1) i am trying to prepare an excel sheet with all the org limits details as follows

i have written an vf page and an apex code which will extract the object name with the limits corresponding to it

similary i am trying to figure how to get the other details

Item               Usage      Limit  % used
Custom Fields 19           800     2%  
Custom Relationship Fields 2 50 4%  
Active Workflow Rules 1 100 1%  
Total Workflow Rules 1 500 0%  
Approval Processes 0 500 0%  
Active Lookup Filters 0 10 0%  
Active Validation Rules 0 500 0%  
VLOOKUP Functions 0 10 0%  
Sharing Rules (Both Owner- and Criteria-based) 0 300 0%  
Sharing Rules (Criteria-based Only) 0 200 0%  



i want to get the details of others highlighted in bold

Kindly help me how to get thse info pls
 
MY APEX CODE :

public class ObjectListController {
    public String val {get;set;} 
    public List<SelectOption> getName() 
    { 
        
        List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();      
       
        List<SelectOption> options = new List<SelectOption>(); 
        for(Schema.SObjectType f : gd) 
        { 
            
            options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel())); 
            
        } 
        return options; 
        
    } 
    public List<String> getObName() 
    { 
        List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();      
        List<string> options = new List<string>(); 
        for(Schema.SObjectType f : gd) 
        { 
            
           	string ObjectName = f.getDescribe().getLabel();
            system.debug('ObjectName==>'+ObjectName);
             integer FieldCount = f.getDescribe().fields.getMap().size();
			system.debug('FieldCount==>'+FieldCount);
			
            options.add(f.getDescribe().getLabel() +' ; '+ f.getDescribe().fields.getMap().size()); 
            
          
        } 
        System.debug('wewetwet'+options);
        return options; 
        
    } 
 
}
MY VF CODE :

<apex:page controller="ObjectListController" readOnly="true" > 
    <apex:form >
        <apex:pageBlock >
        <apex:pageBlockTable value="{!obName}" var="o">
            <apex:column value="{!o}"/>
        </apex:pageBlockTable> 
        <apex:SelectList value="{!val}" size="1"> 
            <apex:selectOptions value="{!Name}"></apex:selectOptions> 
        </apex:SelectList> 
            </apex:pageBlock>
    </apex:form> 
</apex:page>


Kindly help me pls

Thanks in Advance
ManojjenaManojjena
Hi Sfdc007,

All salesforce limit you can find in the PDF belwo ,Download the below pdf .
https://ap1.salesforce.com/help/pdfs/en/salesforce_app_limits_cheatsheet.pdf

Let me know if it helps!!
Thanks
Manoj
Alexander TsitsuraAlexander Tsitsura
Hi sfdc007 

Some of limtis you can find of System overview page. Setup -> System Overview.

Thanks,
Alex
sfdc007sfdc007
i want to find it individually for evry object with all the details above , thats why i wrote the apex code

i got the custom object names , similarly i want to find for the following also

 
Bala 1585Bala 1585
Hi Sfdc007,

Use ToolingAPI or MetadataAPI to get the count of Workflows , validiation rules available in the org and calculate the percentage out of it.


Plz let me know if it helps!!

Thanks,
Bala
sfdc007sfdc007
can you pls help me with the code pls
sfdc007sfdc007
this is the current code i used to get the object field limit count
MY APEX CODE :

public class ObjectListController {
    public String val {get;set;} 
    public List<SelectOption> getName() 
    { 
        
        List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();      
       
        List<SelectOption> options = new List<SelectOption>(); 
        for(Schema.SObjectType f : gd) 
        { 
            
            options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel())); 
            
        } 
        return options; 
        
    } 
    public List<String> getObName() 
    { 
        List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();      
        List<string> options = new List<string>(); 
        for(Schema.SObjectType f : gd) 
        { 
            
           	string ObjectName = f.getDescribe().getLabel();
            system.debug('ObjectName==>'+ObjectName);
             integer FieldCount = f.getDescribe().fields.getMap().size();
			system.debug('FieldCount==>'+FieldCount);
			
            options.add(f.getDescribe().getLabel() +' ; '+ f.getDescribe().fields.getMap().size()); 
            
          
        } 
        System.debug('wewetwet'+options);
        return options; 
        
    } 
 
}

 
Bala 1585Bala 1585
Hi,

I don't have any code as such, But please check below URL for reference
https://github.com/financialforcedev/apex-mdapi (https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_overview.htm)

https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_overview.htm

Below is the output for Workflow rule tested using Workbench

User-added image