0

I need to come up with a SOQL Query for the code used limit, which is apporaching it's maximum. I want to identify the Classes that are using the most characters. What should I query to identify the largest Classes and get the right number of characters in them?

enter image description here

4

Not quite sure if I understand what you're asking for, but I'll give it a shot.

I believe that you're looking for the apexclass object, which can be queried via SOQL.

It ends up being a simple query

[SELECT Id, Name, LengthWithoutComments FROM ApexClass ORDER BY LengthWithoutComments DESC]

The above will give you a list of Apex Classes, as well as their size, from the largest to the smallest.

Note that triggers also contribute to the characters of code that you're allowed to have. The query for those is exactly the same, you just need to replace 'ApexClass' with 'ApexTrigger' (link to ApexTrigger docs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.