+ Start a Discussion
arigelaarigela 

Percent of Apex Used: XX.XX% in salesforce

Hi I Want to get "Percent of Apex Used: XX.XX% " and need to send email at perticular level.

Can you please help on this?

Below queries are using for getting but not able to get correct result(These are tooling api objects).

1. SELECT Sum(LengthWithoutComments) FROM ApexClass WHERE ID NOT IN (SELECT ApexTestClassId FROM ApexCodeCoverage)
2. SELECT Sum(LengthWithoutComments) FROM ApexTrigger

I am doing sum of these two result.((Sum(1+2)/10000000)*100)

Thanks
Venkat
Ankit AroraAnkit Arora
Not sure but I don't think there is any way to do this even with Tooling API. What are the exact results you are getting from these queries?
Pramod_SFDCPramod_SFDC
Hi

Are you sure, this query is working. Also can you please explain from where did you get the field " Sum(LengthWithoutComments)". As you have mentioned this is a Tooling API objects, we cannot use this as normal objects. However, in workbench we have an option to quesry this REST Explorer, but in general you have to create your own application to use this Tooling API objects. Below mentioned link will provide you more information on how to query using workbench.

>>https://help.salesforce.com/apex/HTViewSolution?urlname=Winter-14-How-can-I-get-the-code-coverage-of-a-class-using-the-API-186&language=en_US

I hope this helped you.

Regards
Pramod