+ Start a Discussion
arigelaarigela 

Get Apex Percentage Used in Salesforce.

Hi All,

I have plan to get apex percentage used in salesforce through codding. So, for this I am trying to get size without comments from each apex class or currently using characters from apex.

If we able to get directly apex percentage used, then no issues, my problem will solve.

Can you please help me any one on this.

Please find attached image for more details.

Thanks 
VenkatUser-added image
Ankit AroraAnkit Arora
Did you get any success in getting size without comments? I think after that how about calculating the size of per character * total character / number to get the result in KB?
arigelaarigela
Hi Ankit,

I am able to query size without comments for single class. Run below queries in developer console check Tooling API Check box.

SELECT LengthWithOutComments FROM ApexClass WHERE Id =: 'XXXX' -- It is getting correct result.

when I am doing sum for all classes not getting correct result. That is not equal to currently using characters.
SELECT Sum(LengthWithoutComments) FROM ApexClass WHERE ID NOT IN (SELECT ApexTestClassId FROM ApexCodeCoverage)

Please let me know is there any idea to get correct result.

Thanks
Venkat